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
William29
Helper I
Helper I

Python visuals in powerBI- data in values field not showing correctly

I have a dataset I have imported into a report called new array:

 

William29_0-1661650611403.png

 

If you actually go to 'transform data' and look at new array you will see it looks like this:

 

William29_1-1661650691088.png

 

 

The dataframe has over 40000 rows. Yet if you look at the first screenshot, which has includes a python visualization where the code  produces an exception that details the length of the dataset it suggests that it only has 8073 rows. The data has somehow not been imported into python properly. As a further example, I have now designed the python code to produce an exception and display what column 2 of newarray looks like according to python:

 

William29_2-1661650933911.png

 

As you can see the values it has produced look nothing like the correct values from column 2 of new array that is seen in 'transform data' (look at column 2 in the second screen shot). What values do appear, seem to be a subset of the values from column 2 and an in ascending order.

 

Can someone tell me why the data in python (within python visualization) is not imported directly as it looks in 'transform data'. I want all of the approximately 40000 rows and in their original order (not in ascending order). How do I fix this?

Here is the link to report on the google drive.

https://drive.google.com/file/d/1Ky0Duon9vq2ObIBSQvd_G8BLjBmdADgu/view?usp=sharing

 

 

 

 

2 REPLIES 2
William29
Helper I
Helper I

I have now solved this issue. The cause of it was the drop_duplicates command that is automatically done within the script of the python visualization. It was solved by adding a column consisting of integers from 1 to the number of rows, which ensures that no duplicates are removed and allowed me to rearrange the dataset back to what it was

Anonymous
Not applicable

Hi @William29 ,

 

You may need to check if the packages you are using were supported in Power BI.

https://docs.microsoft.com/en-us/power-bi/connect-data/service-python-packages-support .

 

Best Regards,

Jay

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.