Microsoft adds Python support to Power BI

A preview feature allows Python scripts to be used as data sources and as a way to create visualizations in Power BI Desktop

Serdar Yegulalp Aug 23rd 2018

Power BI, Microsoft’s business analytics and data reporting suite, now integrates with the Python programming language by way of a feature preview in the August 2018 release of Power BI.

As described in a blog post summarizing the release, Python scripts may be run directly inside the Power BI Desktop application, and can be leveraged for “data cleansing, analysis, and visualization.” 

By selecting “Python” in the “Get Data” dialog, the user can paste a Python script into a supplied window and use a script’s dataframe output as a source. Python scripting can also be used to create visuals in a report. The visuals update automatically whenever data changes, although “the visual itself is not interactive.”

Microsoft has also supplied a demo Power BI file with working examples of popular Python packages used to create visualizations and transformations for a sample data set. Included examples feature the Seaborn and Altair visual plotting libraries; Scikit-learn, a popular library for machine learning tasks; FlashText, a regex-like seach-and-replace system; and PyFlux/Pendulum for date and time parsing.

Power BI has long integrated with R, another popular language for data manipulation and analytics. But while R has remained a niche language, Python has enjoyed wide adoption in both data science circles and the general programming population, thanks to its broad selection of third-party packages that handle nearly every conceivable data-handling need.

Microsoft may also be considering Python integration with its Excel spreadsheet product, based on a user survey about Excel that circulated late last year. However, no official announcement has been made yet. Microsoft emphasized after the conclusion of the survey that this was “an area of exploration for us, without any specific timeline.”

Other additions to Power BI this time around include a long-awaited print-to-PDF feature for reports, and a data connector for Apache Spark clusters. Many of the updates for Power BI Desktop are slated to show up in a future release of Power BI Report Server, a version of which is due in late August 2018.