I have a problem of plotting the data. I run the following python code:
import pandas as pd
df = pd.read_csv("table.csv")
values = df["blah"]
values.plot()
print 1
df['blahblah'].plot()
print 2
My output is:
50728417:Desktop evgeniy$ python test2.py
1
2
50728417:Desktop evgeniy$
And finally I see how launches python icon( picture of rocket, by the way , what is it?) in my Dock( using mac os), and then it disappears. Printed numbers 1,2 show me that no error exist. So have no idea what to do next.
The problem is that pandas's DataFrame.plot
does not block. Therefore the figures are closed when your program ends. Pandas uses matplotlib internally so you can circumvent this by calling matplotlib.pyplot.show
with block=True
like so:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("table.csv")
values = df["blah"]
values.plot()
print 1
df['blahblah'].plot()
print 2
plt.show(block=True)
This way the program will only end when plt.show
returns, which is after you closed all figures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With