Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I am writing a power query to run a web scraper that goes through a list of ID's in my dataset and searches for them in a search bar on a site. For some reason, Power BI is adding ".0" to the end of every number.
So my code takes the ID from the dataset and converts it to a list. Then it converts the ID's to strings and strips the 00's at the beginning of the ID:
FRID_list = dataset["FRID__c"].tolist()
FRID_listn = [str(z) for z in FRID_list]
new_frid =[]
for q in FRID_listn:
q.lstrip('0')
new_frid.append(q.lstrip('0'))
Then it iterates through that list, and types it in to a search bar:
for ID in new_frid:
browser.fill('query', 'FRID ' + ID + '\n')
When I run the code as a python visual, it works fine, but if I run it in the power query, it adds .0 to the end of the ID:
It doesn't do that in the regular python visual though. I though initially that it was turning it in to a float, but the code specifically turns it in to a str to it can be stripped. Can someone please advise why this is doing this and what I can do to fix it?
Have you found a solution? I have the same problem. I found that it occurs if there is at least one empty string or null value in the column. If the column does not contain empty strings or null then ".0" is not added to the number
Hi @Anonymous
Sometimes Power Query will change data type automatically.
You could open Advanced editor to see if there is a Change type step.
Delete this step from the "Applied Steps" pane on the right.
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.
Hello @v-juanli-msft,
Thank you for the response.
There aren't any change steps that I can see, the advanced editor just has my code in it and the applied steps only has a filter step, then my python script. I have underlined in the picture below the step where it is typing the id into the search bar.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
9 | |
9 | |
7 | |
6 | |
6 |