Statistical Tables in Power BI with Python

One of the best things about Python is the sheer number of libraries that can easily be used. You can create correlation tables and statistic summary tables similar to what you find in the data analysis tool kit or in the Pandas library in Python with the native functions.

How to create a correlation table:
1. In the Query Editor, Click Run Python Script
2. Copy and Paste the code below:

dataset = dataset.corr()
dataset = dataset.reset_index()

The data sets uploaded in Power BI query editor is formatted into a Python Pandas data frame. The data frame functions such as the correlation function, CORR(). You will need to also reset the index with the RESET_INDEX() function to view the labels along the Y-axis. You can copy and paste the code above because the data is saved in a default variable called dataset.

Gaelim Holland

Notify of
Inline Feedbacks
View all comments