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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors