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 script returning Nulls where there should be data

I have imported data from a MSSQL data source, and I can review it in the query editor just fine. but I'd like to transform it in a fairly complex way, so I'd like to run a python script. However the data isn't coming out right and I'd like some help with it if possible:

As I understand it, the python script receives the data in the form of a pandas dataframe, and when it complets, all pandas daatframes in memory will be returned as datasets. Thus, if I leave the python script empty, I should get a dataframe called "dataset", which is identical to the MSSQL query result used as it's input. This mostly works, however some of the data is coming out as "Null", where there is data in the MSSQL query. 

I tried running this with different python runtime environements and it doesn't seem to help. Does anyone have any ideas?

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Could you show example data which is not null in MSSQL data source?

Do you meet the same scenario as thread1 and thread2?

 

Best Regards
Maggie

 

Anonymous
Not applicable

Hi. No, my problem is unlike those that you linked. it isn't that specific entries are being imported incorrectly - entire rows of ~40 entries each are gone. The missing entries are all kinds of data types, including integers, floats, character strings and datetimes. It's always an entire row that disappears, never parts of a row.

Unfortunately I'm having trouble replicating the problem for a demonstration dataset, but it persists in the data that I have for the model. I cannot share our data due to company policy. 

Fortunately, I have managed to perform the modifications I needed in pure SQL - so I was able to avoid python scripting altogether. I am still not sure what caused it.

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.