Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Running Python Script inside Power BI

My steps are below:

tan_thiam_huat_0-1654237599045.png

Click OK.

tan_thiam_huat_1-1654237669835.png

Click OK.

It gives below:

tan_thiam_huat_2-1654237732408.png

 

tan_thiam_huat_3-1654237753852.png

Though I tested "import os" is OK above, so where is the break? So where did I miss out certain steps?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

The Power BI Python integration requires the installation of two Python packages:

  • Pandas. A software library for data manipulation and analysis. It offers data structures and operations for manipulating numerical tables and time series. Your imported data must be in a pandas data frame. A data frame is a two-dimensional data structure. For example, data is aligned in a tabular fashion in rows and columns.
  • Matplotlib. A plotting library for Python and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits, such as Tkinter, wxPython, Qt, or GTK+.

 

The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right.

So in a console or shell, use the pip command-line tool to install the two packages. The pip tool is packaged with more recent Python versions.

pip install pandas
pip install matplotlib

 

For more information, please refer to:

Run Python Scripts in Power BI Desktop - Power BI | Microsoft Docs

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

The Power BI Python integration requires the installation of two Python packages:

  • Pandas. A software library for data manipulation and analysis. It offers data structures and operations for manipulating numerical tables and time series. Your imported data must be in a pandas data frame. A data frame is a two-dimensional data structure. For example, data is aligned in a tabular fashion in rows and columns.
  • Matplotlib. A plotting library for Python and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits, such as Tkinter, wxPython, Qt, or GTK+.

 

The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right.

So in a console or shell, use the pip command-line tool to install the two packages. The pip tool is packaged with more recent Python versions.

pip install pandas
pip install matplotlib

 

For more information, please refer to:

Run Python Scripts in Power BI Desktop - Power BI | Microsoft Docs

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , In the video and description I have given problems and their solution, refer if those can help

 

How to make Python work with Power BI: https://youtu.be/5D0BkNsu5CM

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.