Let’s filter records where the number of Employees is greater than 5000. We will use the query:
# 'dataset' holds the input data for this script import pandas as pd dataset_filtered = dataset.query('Employees > 5000')
It should look like below. Click OK:
You may get this message regarding privacy levels. Per the Power BI documentation, “For the Python scripts to work properly in the Power BI service, all data sources need to be set to public“. Click Save:
This will output below. Click on dataset_filtered:
Your dataset will now be filtered accordingly:
In the next post, we will look at using the Python visualization in Power BI.