Skip to content
Advertisement

SQL retrieval: Empty Dataframe in IDLE or Visual Studio Code but populated Dataframe in Jupyter Notes

I am not a good python coder (beginner) so apologies if the code isn’t up to pythonista’s snuff! Bit of a weird situation and I can not figure this out. I have been wracking my brains trying to fix it out but can’t seem to be able to. I am sure it’s a really simple fix I am overlooking…

The “allData” Dataframe is pulling data from an SQL database. From that I am extracing a number of records and appending to the “managerListImput” empty dataframe. I am iterating for a number of records specified and looking up the details for each one before appending. It works in Jupyter notes and I get the desired output but when I run it in IDLE or Visual Studio Code I get an empty dataframe. Very frustrating. Hopefully someon can solve it…. Thanks in advance

Here’s the code:

Output in IDLE or Visual Studio Code:

Output (in Jupyter Notes) i.e. the output I want!::

Advertisement

Answer

The solution was simple: the managerID has to be turned into an integer, so I added this:

I guess Jupyter Notes is smart enough to recognize it as a number.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement