I have the following code and was wondering how to plot it as a graph in python
year,month,sales,expenditure
2018,jan,6226,3808
2018,feb,1521,3373
2018,mar,1842,3965
2018,apr,2051,1098
2018,may,1728,3046
2018,jun,2138,2258
2018,jul,7479,2084
2018,aug,4434,2799
2018,sep,3615,1649
2018,oct,5472,1116
2018,nov,7224,1431
2018,dec,1812,3532
this is my code so far
import matplotlib.pyplot as plt
import csv
x = []
y = []
with open('sales.csv','r') as sales_csv:
plots = csv.reader(sales_csv, delimiter=',')
for row in plots:
x.append(row[1])
y.append(row[3])
plt.plot(x,y, label='Loaded from file!')
plt.xlabel('x')
plt.ylabel('y')
plt.show()
