as the title explains I'm trying to read in a CSV file and plot it, the file is in the following format:
Dishwasher,60,1,1,1,0,0,1
Washing Machine,200,0,0,0,0,1,1
where I just want to plot the 6 digits at the end.
Here is my code so far:
import matplotlib.pyplot as plt
import numpy as np
import csv
y1=[]
y2=[]
x = np.array([1,2,3,4,5,6])
with open('File.csv', 'r') as csvfile:
plots = csv.reader(csvfile, delimiter=',')
rows = [row for row in plots]
y1=int((rows[0])-2)
y2=int((rows[1])-2)
plt.plot(x,y1, label='Washing Machine')
plt.plot(x,y2, label='Dishwasher')
plt.show()
I've been trying to solve the problem for hours now but everything I do brings about a new error.
In this code, the error is:
TypeError: unsupported operand type(s) for -: 'list' and 'int'
Which from my understanding means it's trying to convert a list into an integer which isn't possible? Thanks for any and all help