i'm studying python through a book, now I'm stuck trying to make a graph that shows some data, the graph appears but I can't show that data inside the graph, the code in the book shows that the loop return must be transformed into int numbers , how do I do that? since when I try it always gives an error so I did a "try" to continue with the code and now I only get the empty graph and no data.
import csv
from matplotlib import pyplot as plt
filename = 'sitka_weather_2014.csv'
with open(filename) as f:
reader = csv.reader(f)
header_row = next(reader)
hights = []
try:
for row in reader:
hight = int(row[1])
hights.append(hight)
except ValueError:
pass
print(hights)
fig = plt.figure(dpi=128, figsize=(10, 6))
plt.plot(hight, c='red')
plt.title('Daily high temperature, July 2014', fontsize=24)
plt.xlabel('', fontsize=16)
plt.ylabel('Temperature (F)', fontsize=16)
plt.tick_params(axis='both', which='major', labelsize=16)
plt.show()