Power BI

Getting Started with Python Scripting in Power BI

Our online Power BI trainings are conduced in a live, interactive environment. Before any Power BI online training, our team ensures that the attendees have all the tools downloaded in their local system. In this blog post, a step-by-step guide on downloading, installing and integrating python in Microsoft Power BI is presented.

Python is a programming language that is widely used by statisticians and data scientists. Python has simple syntax and a well-developed library-support that helps to filter, analyze and visualize complex data sets. To enhance user experience, Microsoft has integrated Python in the Power BI desktop. This chapter is not intended to teach you Python language but to demonstrate Power BI’s integration with Python.

Install Python

The Power BI tool does not contain python by default. You have to install Python on your computer before you can use it in Power Bi.

To download Python:

1. Visit https://www.python.org/downloads/

2. Download Python.

Power BI Online training in Australia - Installation

You may enable the option ‘Add Python 3.7 to PATH’ to add this into the environment or you may add it manually.

After successful installation of the setup, the following window will appear.

Power BI Online training in Australia - Successful Installation

Install Python Packages 

To successfully run Python in Power BI tool, you need to install two main Python packages using the command prompt:

  • Pandas
  • Matplotlib

We need to install the packages to use numerous prebuilt functions for data visualization and data manipulation operations. With the help of these packages, we can quickly get our desired output instead of writing long codes.

Pandas is an open-source, BSD-licensed Python library providing high-performance, and easy-to-use data structures and data analysis tools for the Python programming language.

1. Type the following command in command prompt.

Power BI Online training in Australia - Installing Pandas

Similarly, we need to install the Matplotlib plotting library for the Python programming language.

2. Type the following command in the command prompt.

Power BI Online training in Australia - Installing Matlplotlib

Add Python Folder Path

Now we need to add the Python folder path in the environment variable

3. Go to Control Panel.

4. Click on System and Security.

5. Click on System.

6Click on Advanced in System settings (in the left corner).

7. Click on Environment Variables.

Power BI Online training in Australia - Advanced System Settings

In the Environment Variables, click ‘New’, and it opens a pop up box. Enter the below details in the edit user variable page.

Variable Name: PythonPath

Variable Value: C:\Users\rajen_000\AppData\Local\Programs\Python\Python37 (Change this Value according to your settings)

Power BI Online training in Australia - Adding Path

Verify Installation in Power BI

After installing Python, verify Python’s connection with Power BI using the Get Data feature.

  1. Select Get Data from the Home tab and click on More

A subsequent window will display the list of all the data sources to which Power BI can connect.

Power BI Online training in Australia

2. From the list, select Python Script and click on Connect.

When you click Connect, the below window pops up. A path of your local library will be mentioned (as highlighted), which will verify that connection is successful. If connection is unsuccessful, an error will be displayed.

Power BI Online training in Australia

Conclusion:

Python is one of the most widely used programming language with a growing user base. Microsoft has integrated Python in Power BI and now python can be used for data analytics in Power BI. In this blog post, a step by step guide on downloading, installing and integrating python with Microsoft Power BI is presented.

More Checkouts for Power BI Training in Australia.

Back to list

Leave a Reply

Your email address will not be published. Required fields are marked *