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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Python Script Error : The preview for Section1/Query1/Source doesn't exist

Hi Team,

 

For my dashboard I am using Python script for data extraction and performing some ETL opearation to fine tune the data.

 

My dataframe declaration  is quite similar to the below dataframe.

 

import pandas as pd
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float)

 

I have set the path of Python home directory in the settings part of PowerBI desktop as shown below.

 

Python Directory:

Python Installed directory.PNG

 

Error:

 

If I am executing the script outside of Power BI desktop then the script is working fine and it's producing the desired output.

But when I am executing the same script from Power BI desktop then it's throwing the below error.

Error Snap Shot.PNG

 

I am not able to proceed further from last 1.5 days , kidly help me in fixing this issue.

4 REPLIES 4
Anonymous
Not applicable

Hey!
I just stumbled upon this while trying to troubleshoot the same thing.
When I was receiving this error, it was trying to report a ~650x12 matrix. I scaled back the reporting manually and tried with a single row, and that worked!
The nature of the project I'm working on is to get ADO Work Item data reporting, so I just needed to narrow down the query of work items.
All that to say, try and scale down the number of rows, and see if it works, and then continue to test the bounds.

Hope this helps

amitchandak
Super User
Super User

@Anonymous , refer to the similar solution in the past

https://community.powerbi.com/t5/Desktop/Python-script-error-quot-the-preview-for-section-1-query1-source/td-p/1280261

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

@amitchandak  : If you can observe my Python code , you will find that , I have declared dataframe how they have suggested and also I have provided my python home directory path in seetings. Is there anything extra am I supposed to do ?

@Anonymous , I remember I have setting for IDE too. As show in the last ticket.

 

I have used an Anaconda. My setting are there in this video

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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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 MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.