### START CODE HERE
reader = csv.reader(csvfile, delimiter=',')
step=0
for row in reader:
temperatures.append(float(row[1]))
times.append(step)
step = step + 1
### END CODE HERE
This is what I have done for parsing the row data, it is the same way done in earlier assignments but this time it is giving me an error. I am not able to understand why this is so.
The structure of the csv file is :
Header looks like this:
“Date”,“Temp”
and these are numbers
This is the error:
ValueError Traceback (most recent call last)
in
1 # Test your function and save all “global” variables within the G class (G stands for global)
2 @dataclass
----> 3 class G:
4 TEMPERATURES_CSV = ‘./data/daily-min-temperatures.csv’
5 times, temperatures = parse_data_from_file(TEMPERATURES_CSV)
in G()
3 class G:
4 TEMPERATURES_CSV = ‘./data/daily-min-temperatures.csv’
----> 5 times, temperatures = parse_data_from_file(TEMPERATURES_CSV)
6 TIME = np.array(times)
7 SERIES = np.array(temperatures)
in parse_data_from_file(filename)
11 step=0
12 for row in reader:
—> 13 temperatures.append(float(row[1]))
14 times.append(step)
15 step = step + 1
ValueError: could not convert string to float: ‘Temp’