I was plotting a graph using matplotlib for a csv file.
The Y axis in the graph seems to be out of order. I have check the column. It is of int().
If I try to change y.append(row[1])
to y.append(int(row[1]))
I am getting Value ErrorValueError: invalid literal for int() with base 10: 'Rating/total'
Below is the code
x = []
y = []
with open('Abhigyan_alternate_school.csv','r') as csvfile:
lines = csv.reader(csvfile, delimiter=',')
for row in lines:
x.append(row[0])
y.append(row[1])
plt.plot(x, y, color = 'g', linestyle = 'dashed',
marker = 'o',label = "school ratings")
plt.xticks(rotation = 50)
plt.xlabel('school Name')
plt.ylabel('Rating/total')
plt.title('school ratings', fontsize = 20)
plt.grid()
plt.legend()
plt.show()