1

I have been coding in jupyter till now and here is my dataframe from which i was plotting:

High    Low Open    Close   Volume  Adj Close   year    pct_day
month   day                             
1   2   794.913004  779.509998  788.783002  789.163007  6.372860e+08    789.163007  1997.400000 0.002211
3   833.470005  818.124662  823.937345  828.889339  9.985193e+08    828.889339  1997.866667 0.004160
4   863.153573  849.154299  858.737861  853.571429  1.042729e+09    853.571429  1997.714286 -0.003345
5   900.455715  888.571429  895.716426  894.472137  1.022023e+09    894.472137  1998.357143 -0.001216
6   847.453076  837.161537  840.123847  844.383843  8.889831e+08    844.383843  1998.076923 0.003679
... ... ... ... ... ... ... ... ... ...
12  27  909.735997  900.942000  905.528664  904.734009  7.485793e+08    904.734009  1998.133333 -0.000308
28  946.635010  940.440016  942.995721  944.127147  7.552150e+08    944.127147  1998.071429 0.001251
29  950.723837  941.625390  944.760775  947.200773  6.830400e+08    947.200773  1998.076923 0.002899
30  891.501671  883.954989  887.031665  887.819181  6.010675e+08    887.819181  1997.833333 0.001844
31  918.943857  910.320763  916.251549  913.786154  6.879523e+08    913.786154  1997.923077 -0.002772
363 rows × 8 columns

in Jupyter notebook as shows below: Chart Picture

In pyharm i understand i need to use plt.show() but when i use

plt.plot('pct_day')
plt.show()

an empty plot shows up with no data. I am not sure why is it not plotting the pct_day column?

Empty plot

When i use plt.plot(y='pct_day') i got the following error : TypeError: plot got an unexpected keyword argument 'y'

Slartibartfast
  • 1,058
  • 4
  • 26
  • 60

1 Answers1

1

You should be able to use df.plot(y='pct_day') in pycharm too. Just use plt.show() afterwards... plt.plot('pct_day') do not plot anything because you did not give it any data (df.plot() takes data directly from df)

L. Letovanec
  • 535
  • 2
  • 6
  • i get the following error when i do `plt.plot(y='pct_day') ` `TypeError: plot got an unexpected keyword argument 'y'` – Slartibartfast Nov 04 '19 at 09:47
  • Is there anyway i would be able to use crosshair to get the data as i move the pointer along the chart? – Slartibartfast Nov 04 '19 at 10:55
  • Look here https://stackoverflow.com/questions/7908636/possible-to-make-labels-appear-when-hovering-over-a-point-in-matplotlib i think it's what you are looking for – L. Letovanec Nov 04 '19 at 11:02