Hi,
In order to use Python Visuals you need to first install Python( Anaconda or Python Version 3.5) and enable it in Power BI Desktop
Follow these steps to use Python Visuals in Query Editor:
Step 1:
• Load your data into Power BI Desktop
• Get Data > CSV from the Home ribbon in Power BI Desktop
Step 2:
Select the file and select Open, and the CSV is displayed in the CSV file dialog.
Step 3:
Once the data is loaded, you'll see it in the Fields pane in Power BI Desktop.
Step 4:
Open Query Editor by selecting Edit Queries from the Home tab in Power BI Desktop.
Step 5:
In the Transform tab, select Run Python Script and the Run Python Script editor appears
Step 6:
Enter your Python Script in the R Script Editor
Note: You'll need to have the pandas library installed in your Python environment for the previous script code to work properly. To install pandas, run the following command in your Python installation: | > pip install pandas
import pandas as pd
completedData = dataset.fillna(method='backfill', inplace=False)
dataset["completedValues"] = completedData["SMI missing values"]
Step 7:
After selecting OK, Query Editor displays a warning about data privacy.
Step 8:
For the Python scripts to work properly in the Power BI service, all data sources need to be set to public.
Now you can finally create your own visualizations depending upon your dataset.
Hope This Helps!!
https://www.edureka.co/community/43501/how-to-use-python-scripts-in-query-editor