By Mohona Dutta | Reading time 5 mins

Power BI Service With Python Visualizations

In the update released in February 2019 for Power BI by Microsoft, one can now share, distribute and see Python visuals in the reports and dashboards. This update increases the assistance for Python in the Power BI Desktop to the Power BI ecosystem.


This capability finalizes the need for Python in Power BI, helping you to apply Python contents to set up your dataset, apply refined investigation or AI in the Power BI Desktop and individual portal, and afterward plan the outcomes in your Power BI reports using any of the many open-source Python bundles.


Dispensing your reports to the Power BI facility will mechanically refresh these visuals with the most recent information when a client views the report. Similar to the help for R representations in Power BI, your Python visualizations will refresh with cross-filtering in the report, but remind you, the visuals are not interactive.

Power BI Service with Python visualizations - AhaApps

Using Python visuals to publish Power BI reports

You can add a Python visual to your Power BI report by picking the Python visual symbol from the Visualizations sheet in the Power BI Desktop, which adds a placeholder Python content to the report.


Incorporating the fields from your dataset to the Values sheet of the Python visual, subsequently adds the fields to the pandas DataFrame in the placeholder Python script. You can utilize the Python content to make the visualizations you choose.


When the report is published in the Power BI workspace, the auto-refresh feature kicks in and the latest ones can be viewed in the report. There are however, a couple of limitations on the size of the serialized Python dataframe, and the execution sets utilized by the Python scripts.

Python bundles and versions

The initial form of the Python runtime supported in Power BI incorporates versions 2.7.15 and 3.7.1. The runtime is periodically refreshed to keep it updated.


The following Python bundles (non-Intel MKL) are supported for use in the Power BI reports:


  • matplotlib
  • numpy
  • pandas
  • scikit-learn
  • scipy
  • seaborn
  • statsmodels

Security and execution requirements

The Python scripts in the reports are executed by the Power BI system in an isolated sandbox that limits the entrance of the scripts to the network and the other machine assets.


This is to guarantee that the datasets and the Power BI administration are not susceptible against assaults.


The Power BI service also levies other limits on Python script execution. Here is a list that talks about the limits.

Power BI Service With Python Visualizations - AhaApps

These limits guarantee that user-provided scripts are performant, and moderate in the consumption of resources.


These limits apply to the execution of Python scripts in Power BI arena. Python script execution on the Power BI Desktop and personal gateway has a corresponding dataframe size and PNG picture size restrictions, yet the execution time limit is 300 seconds.


These limits guarantee that user-provided scripts are performant, and moderate in the consumption of resources.

The support of Python in Power BI personal gateway

Python can be utilized for prepping data or for analyzing Power BI reports, either with a Python script data connector or by employing a Python script in the Power Query editor for changing data.


When the Power BI report is published with Python scripts to the sphere, they will be executed when the information is refreshed through the on-premises data gateway in the personal mode.


To take the advantage of this feature, you should ensure that the Python runtime with the reliant Python packages are installed as well on the machine hosting your personal gateway.  Make a note that Python script execution isn’t supported for on-premises data portals shared by numerous clients.

In Conclusion

If you are worried about implementing Power BI, or have implemented already and are stuck with the various customization features, then we are just a call or email away.

Author’s bio:

Mohona is a Content Writer for the Marketing team in AhaApps since 2019. When she is not busy attending to her creative, technical side, she likes to binge on sitcoms on Netflix. She loves writing poems and reading short stories when she wants to break away from the humdrum of life.