Forum Discussion
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).
- Anonymous7 years ago
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.
3 Replies
- v-juanli-msft
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
MaggieCommunity 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.- AnonymousNot applicable
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.
- AnonymousNot 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.