如何将PowerBIClient和Streamlit与QuickVisualize集成

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

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.

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:

确定