Skip to main content

Power BI in Jupyter Notebook

 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

Popular posts from this blog

ETL Process in Power BI

 We can make a data analysis process easy using the ETL process in Power BI Desktop.  What is ETL in Power BI Desktop ? ETL (Extract, Transform and Load) data is a process by which we can change the shape of our dataset. You can perform several operations in Power Query editor.  During the ETL process, data is extracted from a data source (raw data), then transformed, corrected and then loaded for the next step. You can do this process manually in Excel but it is time consuming process and at the end of the day, we don't want to do the same process for upcoming new data. It should be done by automation. If you have not read my last blog on Power BI then please go through the link  Blog We will start the ETL process step by step A. Extract Data  B. Transform Data C. Load Data A. Extract Data from a data source To extract data from a data source, click on Get Data. We will extract raw data from Excel sheet and then will connect the sheet with Power BI. You can ext...

Get started with Power BI Desktop

The very first question comes in mind is Should I use Power BI Desktop or Power BI Service to create a dashboard ? You should get started with Power BI Desktop. As I have already told in the first blog ( Blog 1 ) that the flow of creating a report is    Power BI Desktop > Power BI Service > Power BI Mobile

Sign up and get Power BI account

  Power BI Desktop is free for creating a report or dashboard. You can connect any data source which is present in the Data Source List. But if you want to publish the report then you should have a Power BI account.  You can't create a power BI account with the Gmail. You can only create an account with work email address. 👎 If you have any work or college email then you can create an account for free.  You can also take free trial of Pro Power BI account for 60 days.😀 Steps to create Power BI account To get a free trial, follow these steps  Step - 1:   Go to Power BI Page    app.powerbi.com  ðŸ‘ˆ Step - 2:  If you are a new user then click on "Try Free" button Step - 3:  Now new tab will open in your browser and will ask to Sign Up with a work email.  Step - 4:   Now click on Yes  Step - 5:  Fill up the form and click on Start button After that Microsoft will ask to invite your colleagues but you can ...