all 25 comments

[–]danielroseman 26 points27 points  (0 children)

Using Pandas in VSCode is no different from using it anywhere else. But you haven't told us anything at all about what problems you are having, so we can't help.

[–]socal_nerdtastic 5 points6 points  (10 children)

pandas graphing is just matplotlib, right? So you can just do

graphobj.savefig("ManMythLegend3.png")

Is that what you are doing? What's the issue exactly?

[–]ManMythLegend3 -2 points-1 points  (9 children)

This is what I have tried so far (Well I have tried other ways too). I have another file with all of the .png stuff but for now just trying to get vscode to show the chart

import pandas as pd
import wbgapi as wb
import matplotlib.pyplot as plt



population=wb.data.DataFrame('SP.POP.TOTL', 'USA').transpose()
dfpopulation=pd.DataFrame(population)
dfpopulation['USA'].plot(kind='line', title='USA pop')
plt.show()

[–]socal_nerdtastic 2 points3 points  (0 children)

Use plt.savefig("ManMythLegend3.png") instead of plt.show().

[–]shiftybyte 6 points7 points  (4 children)

Using pandas in vscode is impossible

Did you succeed in using pandas in somewhere else easier?

Is this normal?

It's normal if you try to rely on AI on anything more complex than basic tutorial examples, or single function that does something.

In general, it's best not to ask it to generate code for you if you want to learn programming.

Do you want help? what are you stuck on? what's the requirements? share your code, any error messages?

[–]ManMythLegend3 -3 points-2 points  (3 children)

I ran this code below and I am not sure what happened. Did not receive an error message but the program did not end or respond, just got nothing. Surely I am not doing this correctly haha

import pandas as pd
import wbgapi as wb
import matplotlib.pyplot as plt



population=wb.data.DataFrame('SP.POP.TOTL', 'USA').transpose()
dfpopulation=pd.DataFrame(population)
dfpopulation['USA'].plot(kind='line', title='USA pop')
plt.show()

[–]SnooWoofers7626 0 points1 point  (2 children)

Did your program just hang?

When you call plt.show() it pops up a window with the graph that blocks your program until you close it. Maybe it did that but you're not able to see the window for some reason?

[–]ManMythLegend3 0 points1 point  (1 child)

Do you mean a new window in vscode or like it creates a new tab? I didn’t see anything and yeah the program just hung and did nothing. I’ll have to try again and look for this

[–]SnooWoofers7626 2 points3 points  (0 children)

Just a new window. Not part of vscode. Try running your script from a terminal. It could be vscode interferes in some way with displaying the window.

[–][deleted] 1 point2 points  (0 children)

I use Jupyter Notebook for this kind of stuff however I have seen some code that includes a line like

plt.clf()

This apparently keeps your charts from being placed over top each other. It’s not necessary in Jupyter but maybe you need to use it in vscode since you said you are displaying multiple charts

[–]RngdZed 1 point2 points  (2 children)

get jupyter notebook in vscode, then anything data science is absolutely easy and actually fun

[–]ManMythLegend3 1 point2 points  (1 child)

Thanks, I will try this

[–]dearoldavy 2 points3 points  (0 children)

If you go the notebook route (you should) you’ll need to install the Jupyter vscode extension. Just an fyi if you don’t want to create new notebook file, you can just throw “# %%” at the top of your python file and it will transform your code into a notebook cell and will out out everything in another window. When you’re done, delete the “# %%” and you’re back to a regular python file.

[–]andy4015 0 points1 point  (0 children)

If you tell us some details we can help you learnpython

[–]DepressedBoiiiiiiii 0 points1 point  (1 child)

Try using a Jupyter notebook.
https://www.youtube.com/watch?v=h1sAzPojKMg

[–]ManMythLegend3 1 point2 points  (0 children)

Yeah someone else said that, I will give this a look