Given the data:
Column1; Column2; Column3
1; 4; 6
2; 2; 6
3; 3; 8
4; 1; 1
5; 4; 2
I can plot it via:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('test0.csv',delimiter='; ', engine='python')
titles = list(df)
for title in titles:
if title == titles[0]:
continue
df.plot(titles[0],title, linestyle='--', marker='o')
plt.savefig(title+'.png')
But if, instead, data was missing Column1 like:
Column2; Column3
4; 6
2; 6
3; 8
1; 1
4; 2
How do I plot it?
May be, something like df.plot(title, linestyle='--', marker='o')?
Column2 X index, but index is missing.reset_indexto set theDF's index to the default integer index and then passColumn2as the y arg of the plot as:df.reset_index().plot(y='Column2', linestyle='--', marker='o')