There is a good news from Microsoft Power BI.
Now you can use Power BI in Jupyter Notebook. You can get your Power BI analytics in a Jupyter notebook with the new powerbiclient Python package.
Now you can embed Power BI reports, dashboards, dashboard tiles, etc., in Jupyter notebooks easily. You’ll be able to export data from visuals in a Power BI report to the Jupyter notebook for in-depth data exploration. You can also filter the report for quick analysis or use bookmarks to apply a saved view.You can install the Power BI Client for Jupyter from PyPI and find the open-sourced Python package and associate TypeScript widget on GitHub.
Install the package using pip:
pip install powerbiclient
Open your notebook and add the following:
Import Report class and models from the package :
from powerbiclient import Report, models
Authenticate against Power BI using Azure AD :
# Import the DeviceCodeLoginAuthentication class to authenticate against Power BI from powerbiclient.authentication import DeviceCodeLoginAuthentication # Initiate device authentication device_auth = DeviceCodeLoginAuthentication()
Set the workspace ID and report ID you’d like to embed:
group_id=""
report_id=""
Create an instance of Power BI report and load the report to the output cell:
report = Report(group_id=group_id, report_id=report_id, auth=device_auth)
report
You can also authenticate against Power BI using an embed token. To do this, pass the embed token and set the token type to
Embed
when creating the Power BI report instance:report = Report(group_id=group_id, report_id=report_id, access_token=access_token, token_type=models.TokenType.Embed.value)
You can see a demo Power BI in Jupyter Notebook
Reference
Comments
Post a Comment