Is there any way to specify column number as an index to show on x-axis? Consider the following dataframe
Metric Value Metric Value Metric Value Metric Value
0 3 3 7 7
1 1 1 1 1
2 0 0 0 0
The code below, plots row[0] however, as you can see, "metric Value" is written on the x points. I would like to see 1, 2, 3, 4 instead.
row = df.iloc[0]
row.astype(int).plot()
plt.show()
CodePudding user response:
Try this:
df.columns = range(1, len(df.columns) 1)
row = df.iloc[0]
row.astype(int).plot()
plt.show()