Old way to read the csv file
import csv
with open("weather_data.csv") as data_file:
data = csv.reader(data_file)
temperatures = []
for row in data:
if row[1] != "temp":
temperatures.append(int(row[1]))
print(temperatures)
Using panda to print the csv file
import pandas
data = pandas.read_csv("weather_data.csv")
print(data)
print(data["temp"])
day temp condition
0 Monday 12 Sunny
1 Tuesday 14 Rain
2 Wednesday 15 Rain
3 Thursday 14 Cloudy
4 Friday 21 Sunny
5 Saturday 22 Sunny
6 Sunday 24 Sunny
0 12
1 14
2 15
3 14
4 21
5 22
6 24