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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Python while loop in power query version above 3.9.0

Hi everyone I have a case i really can t understand:

my python code in power query uses a while loop as below:

while i < len(XXX):

 

This works fine in python version 3.9.0 but not in 3.9.4 ???

 

Any one had the same issue or better a solution of this issue (apart from  downgradding to 3.9.0)

 

tks in advance

3 REPLIES 3
rohit1991
Super User
Super User

The issue is likely due to differences in the Python environment or library versions. Solutions:

  1. Check Python Path: Ensure Power Query uses the correct Python path in Options > Python Scripting.
  2. Verify Library Behavior: Check for changes in libraries (e.g., Pandas, NumPy) between Python 3.9.0 and 3.9.4.
  3. Debug in Power Query: Test the script directly in Power Query to identify specific compatibility issues.

Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
Akash_Varuna
Super User
Super User

Could you elaborate the error what you are getting 

You replied to 2 years old post 🙂


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.