Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 8 | |
| 7 |