I have a data set which has dates in the first column, and a "result" integer which is either 1 or 0. The date column was successfully converted to a time object. I tried to plot the values directly using matplotlib's plot function, but that did not work.. Sample:
Date Result
2017-01-06 0.0
2017-01-06 1.0
2017-01-06 0.0
2017-01-07 0.0
2017-01-07 0.0
I tried using df.plot()
, but the resulting plot has very undesirable results.
What I want at the end of the day is dates on the x axis, and the "result" on the y axis. Where am I going wrong? What's wrong with what I'm doing?
df
suggests the use of pandas. Then, in addition to that, you have only two distinct dates. I'm wondering what kind of plot you expect to get, and also exactly what you did. – Cozdf.set_index('Date').plot()
ordf.plot(x='Date', y='Result')
. I guess it's because of the plot use index ofdf
as x-axis. So for yourdf
, it defaults 0->2000. So set the 'Date' columns as index and try again – Nonjoinder