8000 Convert data read from file to correct type · rakash/python-basics-exercises@67ab75c · GitHub
[go: up one dir, main page]

Skip to content

Commit 67ab75c

Browse files
authored
Convert data read from file to correct type
1 parent a0aa5d8 commit 67ab75c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ch16-scientific-computing-and-graphing/2-use-matplotlib-for-plotting-graphs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
my_file_reader = csv.reader(my_file)
2020
next(my_file_reader) # skip header row
2121
for year, temperature, pirate_count in my_file_reader:
22-
years.append(year)
23-
temperatures.append(temperature)
24-
pirates.append(pirate_count)
22+
years.append(int(year))
23+
temperatures.append(float(temperature))
24+
pirates.append(int(pirate_count))
2525

2626
plt.plot(pirates, temperatures, "r-o")
2727

0 commit comments

Comments
 (0)
0