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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Shweta_1585
New Member

How to Python in power bi (csv file how to write dataset)

I am trying to upload csv, file in powerbi for python work but not able to import it.

1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @Shweta_1585 ,

Based on the description, try to use the following code.

df = pandas.read_csv(r'path\to\your_file.csv')

vjiewumsft_1-1724210248622.png

What’s more, it is not recommended to use python scripts to import data if you are new to python.

You can just select the csv.

vjiewumsft_0-1724210175713.png

You can also view the following documents to learn more information.

Solved: PYTHON INTEGRATION WITH POWER BI - IMPORTING EXCEL... - Microsoft Fabric Community

Run Python scripts in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

7 REPLIES 7
v-jiewu-msft
Community Support
Community Support

Hi @Shweta_1585 ,

Based on the description, try to use the following code.

df = pandas.read_csv(r'path\to\your_file.csv')

vjiewumsft_1-1724210248622.png

What’s more, it is not recommended to use python scripts to import data if you are new to python.

You can just select the csv.

vjiewumsft_0-1724210175713.png

You can also view the following documents to learn more information.

Solved: PYTHON INTEGRATION WITH POWER BI - IMPORTING EXCEL... - Microsoft Fabric Community

Run Python scripts in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

Thank you so much its helpful.

Hi, I am trying but not getting proper solution

Shweta_1585_0-1724314291461.png

 

This message showing while importing the file. Can you help me to understand this.

Shweta_1585_1-1724314723379.png

 

Hi @Shweta_1585 ,

Based on the description, you need to install python packages.

vjiewumsft_0-1724319464943.png

What’s more, only pandas data frames import, so make sure the data you want to import to Power BI is represented in a data frame.

vjiewumsft_1-1724319483673.png

vjiewumsft_2-1724319502084.png

Run Python scripts in Power BI Desktop - Power BI | Microsoft Learn

 

Best Regards,

Wisdom Wu

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

daircom
Helper II
Helper II

Hi @Shweta_1585 ,
Can you clarify a bit more what you are trying to achieve? Do you want to create a csv using Python and import it to Power BI? Or are you trying to use the output of Power BI with Python?

Hi, Actually I am trying to import csv file in power bi using python scripting but i am new for phython so not able to import the file properly to complete assignment. I need to give proper dataset address here I am stuck how to do it.

Thanks.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors