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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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