Integrating Python in Power BI With An Example Of Data Wrangling & Data Visualization
With a mix of Power BI & Excel's versatility and coding experience, You can easily wrangle any kind of data and get the most out of it.
Let's see how we can use python in two processes (Data Wrangling & Data Visualization) inside Power BI
- Make sure that anaconda and python3 installed on your pc.
- Our Data set
The dataset I'm using for this article is a Kaggle dataset that I've recently worked on you can check it out here
what we are going to do is to transform some of my work in this notebook to power bi.
- 2. Data wrangling
The data wrangling process in power bi is based inside the query editor
After loading your data click on the transform tab then run a python script then you will need to import your libraries and run your code for me, the dataset only needed to replace some values and to get the date and time for more information check out my Kaggle notebook |
Here's our clean data ready to be loaded |
- 3. Data Visualization
Now let's get to the fun part, From my notebook I've selected two visuals that I wanted to show in my power bi file1- select the python visual
2- load your data into it
3- write your code
4- run
But here are some important notes you should know:- Don't forget to import your libraries (numpy as np, pandas as pd, matplotlib.pyplot as plt, seaborn as sb....etc)
- Your dataset has its name now as 'dataset', not 'df' or else. you will have to change it if you want or keep it as it is.
- Don't forget plt.show() at the end this is our magic word
Regards.
1- select the python visual 2- load your data into it 3- write your code 4- run |
But here are some important notes you should know:
- Don't forget to import your libraries (numpy as np, pandas as pd, matplotlib.pyplot as plt, seaborn as sb....etc)
- Your dataset has its name now as 'dataset', not 'df' or else. you will have to change it if you want or keep it as it is.
- Don't forget plt.show() at the end this is our magic word
Comments
Post a Comment