Microsoft releases a library for PowerBI in Jupyter notebook to allow developers to leverage the power of one of the most widely used business analytics tools’ reports. For several years, Jupyter notebook has become the go-to tool for data scientists but creating reports from Matplotlib and Seaborn and other libraries is not as straightforward as one might think. What beats plotting with just drag and drop with analytics platforms like PowerBI, Qlik, and Tableau?
However, business analytics platforms are not highly popular with data scientists as several preprocessing of data is required to improve the quality and make information ready for visualizations. Although data visualization and report generation require numerous lines of code, they still rely on Jupyter notebooks; switching to a business analytics platform only to visualize is too much for an ask for data scientists.
In addition, machine learning practitioners prefer to showcase everything within Jupyter Notebooks as it is easier to have everything in one place.
During Microsoft Build, the company removed a major pain point of data scientists for visualization in Jupyter notebooks. Now, PowerBI analytics can be accessed with a new
powerbiclient Python package. You can also find the Python package and associated TypeScript widget on GitHub.
You can install the package with:
pip install powerbiclient
The ability to bring PoweBI reports makes the workflow earlier for data scientists as they can collaborate with other developers with ease. All they have to do is import the reports developed by other professionals like data analysts or business analytics with PowerBI. Data scientists can focus more on the advanced work while easily importing the reports of others.
For reports in the Jupyter notebook, you have to authenticate PowerBI using Azure AD and then provide details of the workspace ID and report ID to embed. Eventually, they can load the report to the output cell.
from powerbiclient import Report, models # Import the DeviceCodeLoginAuthentication class to authenticate against Power BI from powerbiclient.authentication import DeviceCodeLoginAuthentication # Initiate device authentication device_auth = DeviceCodeLoginAuthentication() group_id="" report_id="" report = Report(group_id=group_id, report_id=report_id, auth=device_auth) report
Check out the demo here.