The data looks like this:
1 2 3 4
foo
t0 95 95.5 75.5 85
t1 95.75 95.5 75.5 85
t2 96.5 95.5 75.5 85
t3 96.5 95.5 75.5 85
t4 96.5 95.5 75.5 85
... ... ... ... ...
t9996 95.5 95 75.5 85.5
t9997 95.5 95 75.5 85.5
t9998 95.5 95 75.5 85.5
t9999 95.5 95 75.5 85.5
t10000 95.5 95 75.5 85.5
I want to plot the 4 time series against the index. Using code:
df.plot(x = 'foo', y = '1')
I received this error:
KeyError: 'foo'
How should I do this?
Use this. If x argument isn't provided, DataFrame.plot() takes df.index as default.
df.plot(y='1')
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