Learning the basics of Python in Power BI

Introduction to Python in Power BI

Jacob H. Marquez

Data Scientist

Prerequisite knowledge

Introduction to Python in Power BI

What we will be learning

Power BI

  • Importing and joining data with Power Query
  • Finding missing data with Power Query
  • Calculating Correlation Coefficient with Quick Measures

Python

  • Importing and joining data with pandas
  • Finding missing data and imputation
  • Creating visualizations with Seaborn
Introduction to Python in Power BI

Getting started - downloading Python

Introduction to Python in Power BI

Getting started - installing packages

The two required Python packages are:

  • pandas
  • matplotlib

Image of a command line interface terminal.

1 https://packaging.python.org/en/latest/tutorials/installing-packages/
Introduction to Python in Power BI

Getting started - Power BI

"File" > "Options and settings" > "Options" > "Python scripting"

  • Home Directories
  • Integrated Development Environments (IDE)

Power BI settings menu, highlighting the options for Python scripts.

1 https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts
Introduction to Python in Power BI

Getting started - Power BI

Power BI settings menu, highlighting the options for Python scripts. There is a green text box around the home directory settings.

1 https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts
Introduction to Python in Power BI

Getting started - Power BI

Power BI settings menu, highlighting the options for Python scripts. There is a green text box around the integrated development environment settings.

1 https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts
Introduction to Python in Power BI

Limitations

  • DataFrames temporarily saved
  • 150,000 rows used in visualizations
  • Datasets less than 250 MB
  • Datasets set to "Public"
Introduction to Python in Power BI

Benefits and reasons to learn...

Python as a Power BI user

  • Flexibility in data transformations
  • Easier method for difficult calculations
  • Build custom visualizations

Power BI as a Python user

  • Faster data visualization
  • Build quick reporting dashboards
  • Easier sharing with others
Introduction to Python in Power BI

Datasets

fished.csv

entity year fished
Australia 1990 153148
United States 1990 502923
Japan 1990 567895

farmed.csv

entity year farmed
Australia 1990 23567
United States 1990 436758
Japan 1990 534978
Introduction to Python in Power BI

Let's practice!

Introduction to Python in Power BI

Preparing Video For Download...