Plot dataframe columns against each other
Solution 1:
As far as I remember plot
uses the index for the x values.
Try:
df.set_index('CET').plot()
And you should make sure that all you columns have a numeric datatype.
Edit:
df = df.set_index('CET')
num_cols = ['MaxTemp',
'MeanTemp',
'MinTemp',
'MaxHumidity',
'MeanHumidity',
'MinHumidity',
'revenue']
df[num_cols] = df[num_cols].astype(float)
df[num_cols].plot()
plt.xticks(range(len(df.index)), df.index)
Solution 2:
The pandas plotting routines like plot.line or plot.scatter can take the column names for x
and y
arguments:
E.g.
>>> lines = df.plot.line(x='pig', y='horse')
>>> ax1 = df.plot.scatter(x='length',
... y='width',
... c='DarkBlue')