英文:
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.
from powerbiclient import QuickVisualize, get_dataset_config
from powerbiclient.authentication import DeviceCodeLoginAuthentication
import pandas as pd
import streamlit as st
# Import your own CSV as a pandas data frame
df = pd.read_csv('Financial Sample.csv')
# Perform preprocessing
df = df.drop(['Month Number', 'Month Name', 'Year'], axis=1)
df = df.loc[df['Units Sold'] > 1000]
df['Discounted'] = df['Discount Band'] != 'None'
# Initiate device authentication
device_auth = DeviceCodeLoginAuthentication()
# Create a Power BI report from your data
PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
# Render new report
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.
from powerbiclient import QuickVisualize, get_dataset_config
from powerbiclient.authentication import DeviceCodeLoginAuthentication
import pandas as pd
import streamlit as st
# Import your own CSV as a pandas data frame
df = pd.read_csv('Financial Sample.csv')
# Perform preprocessing
df = df.drop(['Month Number', 'Month Name', 'Year'], axis=1)
df = df.loc[df['Units Sold'] > 1000]
df['Discounted'] = df['Discount Band'] != 'None'
# Initiate device authentication
device_auth = DeviceCodeLoginAuthentication()
# Create a Power BI report from your data
PBI_visualize = QuickVisualize(get_dataset_config(df), auth=device_auth)
# Render new report
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
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论