如何将PowerBIClient和Streamlit与QuickVisualize集成

huangapple go评论135阅读模式
英文:

how to integrate powerbiclient and Streamlit with QuickVisualize

问题

I would like to use QuickVisualize to generate the dashboard as in Jupyter notebook, but I would like to apply it in Streamlit.

  1. from powerbiclient import QuickVisualize, get_dataset_config
  2. from powerbiclient.authentication import DeviceCodeLoginAuthentication
  3. import pandas as pd
  4. import streamlit as st
  5. # Import your own CSV as a pandas data frame
  6. df = pd.read_csv('Financial Sample.csv')
  7. # Perform preprocessing
  8. df = df.drop(['Month Number', 'Month Name', 'Year'], axis=1)
  9. df = df.loc[df['Units Sold'] > 1000]
  10. df['Discounted'] = df['Discount Band'] != 'None'
  11. # Initiate device authentication
  12. device_auth = DeviceCodeLoginAuthentication()
  13. # Create a Power BI report from your data
  14. PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
  15. # Render new report
  16. st.write(PBI_visualize)

Not displaying PBI_visualize

英文:

I would like to use QuickVisualize to generate the dashboard as in Jupyter notebook, but I would like to apply it in Streamlit.

  1. from powerbiclient import QuickVisualize, get_dataset_config
  2. from powerbiclient.authentication import DeviceCodeLoginAuthentication
  3. import pandas as pd
  4. import streamlit as st
  5. # Import your own CSV as a pandas data frame
  6. df = pd.read_csv('Financial Sample.csv')
  7. # Perform preprocessing
  8. df = df.drop(['Month Number', 'Month Name', 'Year'], axis=1)
  9. df = df.loc[df['Units Sold'] > 1000]
  10. df['Discounted'] = df['Discount Band'] != 'None'
  11. # Initiate device authentication
  12. device_auth = DeviceCodeLoginAuthentication()
  13. # Create a Power BI report from your data
  14. PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
  15. # Render new report
  16. st.write(PBI_visualize)

Not displaying PBI_visualize

答案1

得分: 1

powerbiclient 允许您将 Power BI 报告嵌入到 Jupyter 笔记本中 - 我不会期望这个包在这种情况下能够直接使用,因为您并未在 Jupyter 笔记本中使用该包。如果您能将 Power BI 报告转换为 HTML,然后通过 st.markdown 将该报告嵌入到 Streamlit 应用中。

英文:

powerbiclient allows you to embed Power BI reports in Jupyter notebooks – I wouldn't expect this package to work out of the box in this case since you're not using the package within a Jupyter notebook. If you can convert the Power BI report to HTML, you could then embed that report in a Streamlit app via st.markdown.

huangapple
  • 本文由 发表于 2023年5月7日 23:06:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/76194703.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定