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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dataset used as a pandas DataFrame in a power query

I have a dataset that I import from salesforce. I wrote a python script that starts with a loop through the ID column and changes it to a list of strings.

 

The code:

FRID_list = dataset['FRID_c'].tolist()
FRID_listn = [str(z) for z in FRID_list]

 

So if I export the dataset to a csv, I can loop through, but when I try to run it through power query it says it doesn't recognize the column name (FRID_c).

 

image.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Nevermind, I figured it out. It was a typing error. I didn't realize the dataset had "FRID__c" as opposed to "FRID_c". I just had to have two underscores. Thanks for the help anyway.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

What's your purpose of this code?

FRID_list = dataset['FRID_c'].tolist()
FRID_listn = [str(z) for z in FRID_list]

"So if I export the dataset to a csv, I can loop through"

Do you use the pythond code to export dataset to csv? 

 

"when I try to run it through power query"

Do you mean Using Python in Query Editor

 

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-juanli-msft 

 

The purpose of my code is to web scrape. I loop through the ID's and look them up on our company site. The rest of the code works fine, I just can't reference the dataset as a dataframe to move that column to a list.

 

Yes, I used the python code to create a dataframe using the CSV version of the dataset. But I need the same code to work in the power query editor using the dataset that I am running the python in. So I go to Edit Queries>Transform>Run Python Code. I try to reference the dataset as a dataframe and it will not recognize the column name.

Anonymous
Not applicable

Nevermind, I figured it out. It was a typing error. I didn't realize the dataset had "FRID__c" as opposed to "FRID_c". I just had to have two underscores. Thanks for the help anyway.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors