要在文本文件中存储数据,最简单的方式是将数据作为一系列以逗号分隔的值(CSV)写入文件。这样的文件称为CSV文件。如下是一行CSV格式的天气数据:
2014-3-2,35,31,26,5,1,-2,36,29,23,29.84,29.79,29.74,10,10,10,15,8,,0.00,0,,82
这是某地2014年3月2号的天气数据,其中包含当天的最高气温和最低气温,还有众多其他数据。CSV文件对人来说难以阅读,但程序可轻松的对其进行处理,这有助于加快数据分析的过程。
第一部分:处理少量某地的CSV格式的天气数据
(1)数据:
名为sitka_weather_07-2014.csv的CSV数据:
AKDT,Max TemperatureF,Mean TemperatureF,Min TemperatureF,Max Dew PointF,MeanDew PointF,Min DewpointF,Max Humidity, Mean Humidity, Min Humidity, Max Sea Level PressureIn, Mean Sea Level PressureIn, Min Sea Level PressureIn, Max VisibilityMiles, Mean VisibilityMiles, Min VisibilityMiles, Max Wind SpeedMPH, Mean Wind SpeedMPH, Max Gust SpeedMPH,PrecipitationIn, CloudCover, Events, WindDirDegrees
2014-7-1,64,56,50,53,51,48,96,83,58,30.19,30.00,29.79,10,10,10,7,4,,0.00,7,,337
2014-7-2,71,62,55,55,52,46,96,80,51,29.81,29.75,29.66,10,9,2,13,5,,0.14,7,Rain,327
2014-7-3,64,58,53,55,53,51,97,85,72,29.88,29.86,29.81,10,10,8,15,4,,0.01,6,,258
2014-7-4,59,56,52,52,51,50,96,88,75,29.91,29.89,29.87,10,9,2,9,2,,0.07,7,Rain,255
2014-7-5,69,59,50,52,50,46,96,72,49,29.88,29.82,29.79,10,10,10,13,5,,0.00,6,,110
2014-7-6,62,58,55,51,50,46,80,71,58,30.13,30.07,29.89,10,10,10,20,10,29,0.00,6,Rain,213
2014-7-7,61,57,55,56,53,51,96,87,75,30.10,30.07,30.05,10,9,4,16,4,25,0.14,8,Rain,211
2014-7-8,55,54,53,54,53,51,100,94,86,30.10,30.06,30.04,10,6,2,12,5,23,0.84,8,Rain,159
2014-7-9,57,55,53,56,54,52,100,96,83,30.24,30.18,30.11,10,7,2,9,5,,0.13,8,Rain,201
2014-7-10,61,56,53,53,52,51,100,90,75,30.23,30.17,30.03,10,8,2,8,3,,0.03,8,Rain,215
2014-7-11,57,56,54,56,54,51,100,94,84,30.02,30.00,29.98,10,5,2,12,5,,1.28,8,Rain,250
2014-7-12,59,56,55,58,56,55,100,97,93,30.18,30.06,29.99,10,6,2,15,7,26,0.32,8,Rain,275
2014-7-13,57,56,55,58,56,55,100,98,94,30.25,30.22,30.18,10,5,1,8,4,,0.29,8,Rain,291
2014-7-14,61,58,55,58,56,51,100,94,83,30.24,30.23,30.22,10,7,0,16,4,,0.01,8,Fog,307
2014-7-15,64,58,55,53,51,48,93,78,64,30.27,30.25,30.24,10,10,10,17,12,,0.00,6,,318
2014-7-16,61,56,52,51,49,47,89,76,64,30.27,30.23,30.16,10,10,10,15,6,,0.00,6,,294
2014-7-17,59,55,51,52,50,48,93,84,75,30.16,30.04,29.82,10,10,6,9,3,,0.11,7,Rain,232
2014-7-18,63,56,51,54,52,50,100,84,67,29.79,29.69,29.65,10,10,7,10,5,,0.05,6,Rain,299
2014-7-19,60,57,54,55,53,51,97,88,75,29.91,29.82,29.68,10,9,2,9,2,,0.00,8,,292
2014-7-20,57,55,52,54,52,50,94,89,77,29.92,29.87,29.78,10,8,2,13,4,,0.31,8,Rain,155
2014-7-21,69,60,52,53,51,50,97,77,52,29.99,29.88,29.78,10,10,10,13,4,,0.00,5,,297
2014-7-22,63,59,55,56,54,52,90,84,77,30.11,30.04,29.99,10,10,10,9,3,,0.00,6,Rain,240
2014-7-23,62,58,55,54,52,50,87,80,72,30.10,30.03,29.96,10,10,10,8,3,,0.00,7,,230
2014-7-24,59,57,54,54,52,51,94,84,78,29.95,29.91,29.89,10,9,3,17,4,28,0.06,8,Rain,207
2014-7-25,57,55,53,55,53,51,100,92,81,29.91,29.87,29.83,10,8,2,13,3,,0.53,8,Rain,141
2014-7-26,57,55,53,57,55,54,100,96,93,29.96,29.91,29.87,10,8,1,15,5,24,0.57,8,Rain,216
2014-7-27,61,58,55,55,54,53,100,92,78,30.10,30.05,29.97,10,9,2,13,5,,0.30,8,Rain,213
2014-7-28,59,56,53,57,54,51,97,94,90,30.06,30.00,29.96,10,8,2,9,3,,0.61,8,Rain,261
2014-7-29,61,56,51,54,52,49,96,89,75,30.13,30.02,29.95,10,9,3,14,4,,0.25,6,Rain,153
2014-7-30,61,57,54,55,53,52,97,88,78,30.31,30.23,30.14,10,10,8,8,4,,0.08,7,Rain,160
2014-7-31,66,58,50,55,52,49,100,86,65,30.31,30.29,30.26,10,9,3,10,4,,0.00,3,,217
(2)分析CSV文件头
csv模块包含在Python标准库中,可用于分析CSV文件中的数据行,让我们能够快速提取感兴趣的值。
import csv
filename = 'sitka_weather_07-2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
print(header_row)
reader处理文件中以逗号分隔的第一行数据,并将每项数据都作为一个元素存储在列表中。
文件头AKDT表示阿拉斯加时间,其位置标明每行的第一个值都是日期或时间。
文件头Max TemperatureF指出每行的第二个值都是当天的最高华氏气温…
(3)打印文件头及其位置
(4)提取,读取每天最高气温数据并绘制气温图表
①首先读取每天的最高气温:
highs = []
for row in reader:
high = int(row[1])
highs.append(high)
print(highs)
阅读器对象从其停留的地方继续往下读取CSV文件,每次都自动返回当前所处位置的下一行。由于我们已经读取了文件头行,这个循环将从第二行开始------从这行开始包含的是实际数据。
②然后使用matplotlib进行可视化操作:
import csv
from matplotlib import pyplot as plt
filename = 'sitka_weather_07-2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
# for index,column_header in enumerate(header_row): #对列表调用enumerate()方法,获取每个元素的索引及其值
# print(index,column_header)
#获取日期和最高气温
highs = []
for row in reader:
high = int(row[1])
highs.append(high)
print(highs)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize=(10,6)) #设置绘图窗口的尺寸
plt.plot(highs,c='red')
#设置图形的格式
plt.title("Daily high temperatures, 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()
(5)在图表中添加日期数据
①首先,分析:读取天气数据文件中日期数据时,获得的是一个字符串,因此我们需要将字符串‘2014-7-1’转换为一个表示相应日期的对象。为了创建一个表示2014年7月1日的对象,可使用模块datetime中的方法strptime()。
方法strptime()将包含所需日期的字符串作为第一个实参;第二个实参告诉python如何设置日期的格式。
方法strptime()可接受各种实参,并根据它们来决定如何解读日期。
②在图表中添加日期:
import csv
from matplotlib import pyplot as plt
from datetime import datetime
'''处理少量csv数据时!'''
filename = 'sitka_weather_07-2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
# for index,column_header in enumerate(header_row): #对列表调用enumerate()方法,获取每个元素的索引及其值
# print(index,column_header)
#获取日期和最高气温
dates,highs =[],[]
for row in reader: #依此循环csv文件的每一行
current_date = datetime.strptime(row[0],"%Y-%m-%d") #取出每一行的下标为0的数据
dates.append(current_date)
high = int(row[1]) #循环的每一行数据为列表形式存在row里,取出每一行的下标为1的数据
highs.append(high)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize=(10,6)) #设置绘图窗口的尺寸
plt.plot(dates,highs,c='red')
#设置图形的格式
plt.title("Daily high temperatures, July 2014", fontsize=24)
plt.xlabel('',fontsize=16)
fig.autofmt_xdate() #使x轴标签绘制为斜的日期标签,以免它们彼此重叠
plt.ylabel("Temperature(F)",fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()
第二部分:处理大量某地的CSV格式的天气数据
(1)数据:
名为sitka_weather_2014.csv的CSV数据:
AKST,Max TemperatureF,Mean TemperatureF,Min TemperatureF,Max Dew PointF,MeanDew PointF,Min DewpointF,Max Humidity, Mean Humidity, Min Humidity, Max Sea Level PressureIn, Mean Sea Level PressureIn, Min Sea Level PressureIn, Max VisibilityMiles, Mean VisibilityMiles, Min VisibilityMiles, Max Wind SpeedMPH, Mean Wind SpeedMPH, Max Gust SpeedMPH,PrecipitationIn, CloudCover, Events, WindDirDegrees
2014-1-1,46,42,37,40,38,36,97,86,76,29.95,29.77,29.57,10,8,2,25,14,36,0.69,8,Rain,138
2014-1-2,41,38,35,38,35,32,97,89,76,30.09,29.90,29.81,10,9,4,14,7,22,0.34,8,Rain,92
2014-1-3,39,36,34,38,36,33,100,97,93,30.43,30.32,30.10,10,9,2,8,3,,0.02,7,Rain,102
2014-1-4,43,38,34,35,33,31,97,82,62,30.43,30.32,30.20,10,10,10,20,6,25,0.00,6,Rain,107
2014-1-5,44,42,41,42,36,32,97,77,63,30.20,30.02,29.88,10,8,2,26,17,36,0.37,8,Rain,113
2014-1-6,44,42,41,43,41,37,100,93,82,30.00,29.92,29.78,10,8,2,14,6,,0.52,8,Rain,111
2014-1-7,44,42,39,41,39,37,100,92,76,29.77,29.71,29.57,10,7,2,21,8,24,0.33,8,Rain,119
2014-1-8,44,42,39,40,39,35,100,92,71,29.54,29.27,29.16,10,9,6,14,4,,0.44,8,Rain,4
2014-1-9,41,39,37,39,36,33,97,87,73,29.53,29.38,29.17,10,9,5,18,7,14,0.39,8,Rain,269
2014-1-10,39,36,30,36,34,30,97,93,79,29.59,29.49,29.12,10,9,4,13,6,,0.24,7,Rain,89
2014-1-11,36,32,30,33,32,29,100,95,81,29.33,29.22,29.11,10,6,0,13,3,,0.28,7,Fog-Rain-Snow,92
2014-1-12,43,38,34,39,35,31,93,82,68,29.60,29.25,29.07,10,8,2,26,16,37,0.24,8,Rain-Snow,258
2014-1-13,48,42,37,46,38,33,93,85,73,30.03,29.82,29.61,10,6,2,31,17,45,1.48,8,Rain,182
2014-1-14,48,45,42,46,42,34,100,87,68,30.20,29.68,29.41,10,5,2,29,20,45,3.59,8,Rain,211
2014-1-15,48,44,41,41,38,35,93,83,68,30.34,30.26,30.07,10,9,4,16,10,23,0.24,8,Rain,140
2014-1-16,51,48,46,44,42,40,93,82,71,30.11,30.04,29.98,10,8,2,25,15,40,0.24,8,Rain,132
2014-1-17,55,50,44,43,35,27,96,61,33,30.10,29.84,29.57,10,9,3,25,13,34,0.09,4,Rain,107
2014-1-18,48,44,39,44,40,36,97,89,71,30.09,29.86,29.53,10,7,3,17,11,23,0.61,8,Rain,186
2014-1-19,45,41,37,38,34,31,93,77,58,30.17,30.14,30.10,10,10,8,16,9,,0.10,7,Rain,108
2014-1-20,46,44,41,41,36,34,96,76,65,30.16,30.07,29.96,10,10,8,21,11,26,0.34,7,Rain,103
2014-1-21,54,50,46,38,35,32,68,56,43,29.99,29.93,29.87,10,10,10,20,16,25,0.00,7,Rain,110
2014-1-22,54,50,48,49,43,38,89,76,61,30.22,30.12,30.01,10,8,3,26,14,38,1.24,8,Rain,124
2014-1-23,55,50,44,49,47,43,96,83,75,30.42,30.32,30.20,10,8,2,23,13,33,0.17,7,Rain,168
2014-1-24,48,44,39,42,39,37,96,90,77,30.42,30.35,30.26,10,9,6,10,3,,0.00,0,,16
2014-1-25,46,42,37,41,39,36,100,93,80,30.25,30.20,30.18,10,10,7,5,2,,0.00,0,,3
2014-1-26,46,40,35,39,37,35,100,88,71,30.25,30.10,29.90,10,10,10,9,2,,0.00,0,,18
2014-1-27,55,50,44,42,37,32,90,64,40,30.04,29.96,29.90,10,10,8,15,9,15,0.00,5,Rain,34
2014-1-28,44,42,37,43,41,36,100,95,92,30.16,30.12,30.05,10,7,2,9,3,,0.54,7,Rain,31
2014-1-29,43,38,33,37,34,33,100,89,71,30.14,30.08,30.03,10,7,0,14,4,,0.00,6,Fog,26
2014-1-30,42,36,30,35,32,29,96,89,70,30.11,30.08,30.04,10,10,10,5,2,,0.00,0,,101
2014-1-31,37,32,28,32,30,28,96,89,82,30.16,30.12,30.09,10,10,10,9,3,,0.00,6,Rain,96
2014-2-1,39,34,28,31,28,25,96,85,70,30.29,30.22,30.16,10,10,10,6,2,,0.00,1,,85
2014-2-2,42,35,28,25,20,15,85,61,34,30.39,30.33,30.28,10,10,10,8,4,,0.00,0,,90
2014-2-3,37,34,30,16,12,6,54,42,32,30.54,30.48,30.40,10,10,10,13,6,21,0.00,1,,91
2014-2-4,34,30,25,11,6,1,53,37,26,30.62,30.59,30.56,10,10,10,10,7,,0.00,0,,92
2014-2-5,35,29,23,11,6,1,58,39,27,30.60,30.56,30.47,10,10,10,10,5,,0.00,0,,83
2014-2-6,32,26,21,17,12,8,75,56,40,30.45,30.17,29.87,10,10,10,8,4,,0.00,0,,99
2014-2-7,36,30,23,25,20,16,85,70,59,30.07,29.95,29.85,10,10,10,7,4,,0.00,3,,108
2014-2-8,33,27,21,18,15,10,82,61,40,30.15,30.10,30.04,10,10,10,9,4,,0.00,2,,96
2014-2-9,28,26,25,16,8,4,66,46,38,30.03,29.96,29.87,10,10,10,22,11,30,0.00,4,,102
2014-2-10,32,28,21,8,2,-2,51,36,28,29.85,29.64,29.51,10,10,10,17,10,25,0.00,1,,81
2014-2-11,28,24,19,17,11,3,75,57,45,29.70,29.51,29.29,10,10,10,18,8,23,0.00,1,,63
2014-2-12,33,25,18,26,22,12,86,76,63,29.45,29.41,29.35,10,6,0,18,11,22,0.00,7,Snow,103
2014-2-13,36,33,30,32,28,14,100,84,44,29.32,29.26,29.09,10,5,0,23,14,31,0.21,6,Fog-Snow,111
2014-2-14,39,36,33,34,33,30,100,89,70,29.29,29.09,28.87,10,7,1,23,10,32,0.66,8,Rain-Snow,55
2014-2-15,44,36,28,34,32,25,100,82,63,29.20,28.95,28.81,10,6,0,30,19,51,0.51,8,Fog-Rain-Snow,120
2014-2-16,37,34,30,29,27,25,92,79,64,29.22,29.11,29.01,10,8,1,16,9,23,0.04,7,Snow,96
2014-2-17,37,34,32,34,31,26,96,83,62,29.31,29.22,29.01,10,8,2,24,10,31,0.02,8,Rain-Snow,103
2014-2-18,39,34,28,32,27,23,100,80,53,29.39,29.27,29.15,10,8,1,13,7,,0.09,6,Snow,92
2014-2-19,37,32,28,32,29,26,96,86,70,29.66,29.58,29.41,10,7,2,13,4,,0.02,7,Snow,102
2014-2-20,35,32,28,32,29,26,96,89,78,30.17,29.89,29.66,10,6,0,21,8,22,0.16,7,Snow,283
2014-2-21,37,32,28,28,27,24,96,85,64,30.27,30.22,30.18,10,8,1,9,6,,0.01,7,Snow,84
2014-2-22,33,30,28,25,13,4,88,50,33,30.32,30.30,30.27,10,10,10,14,7,21,0.00,0,,91
2014-2-23,37,32,27,19,7,0,59,35,24,30.31,30.17,30.06,10,10,10,10,7,23,0.00,0,,70
2014-2-24,39,31,23,21,14,6,69,50,27,30.14,30.12,30.08,10,10,10,14,5,,0.00,2,,73
2014-2-25,45,38,30,34,26,20,79,63,42,30.12,30.05,29.98,10,10,10,14,6,,0.00,3,,323
2014-2-26,46,40,35,40,36,33,96,85,68,29.96,29.82,29.73,10,10,10,6,2,,0.00,3,,80
2014-2-27,43,38,33,37,34,30,92,82,71,29.93,29.84,29.75,10,10,10,7,3,,0.00,5,,17
2014-2-28,46,40,33,35,29,22,92,68,42,29.94,29.93,29.91,10,10,10,8,3,,0.00,2,,350
2014-3-1,42,35,28,21,13,6,61,42,27,29.96,29.92,29.85,10,10,10,16,5,25,0.00,0,,90
2014-3-2,35,31,26,5,1,-2,36,29,23,29.84,29.79,29.74,10,10,10,15,8,,0.00,0,,82
2014-3-3,30,26,23,5,-1,-5,43,32,26,29.98,29.86,29.78,10,10,10,12,6,,0.00,1,,86
2014-3-4,28,26,25,19,13,6,75,57,43,30.07,30.03,29.97,10,10,8,16,10,,0.00,8,Snow,106
2014-3-5,36,28,21,20,14,7,88,59,30,29.95,29.70,29.54,10,10,10,8,3,,0.00,0,,358
2014-3-6,37,28,19,20,12,6,71,49,30,29.72,29.62,29.53,10,10,10,13,4,,0.00,0,,130
2014-3-7,45,38,32,36,29,16,82,66,52,29.68,29.40,29.17,10,10,5,28,11,37,0.08,8,Rain-Snow,99
2014-3-8,45,43,41,41,38,36,93,87,71,29.26,29.15,29.04,10,7,3,22,16,31,1.28,8,Rain,131
2014-3-9,41,38,36,38,36,34,100,90,79,29.83,29.54,29.23,10,8,2,16,9,24,0.83,8,Rain,142
2014-3-10,46,40,35,38,35,32,100,85,63,29.94,29.86,29.78,10,9,5,31,11,40,0.25,7,Rain,109
2014-3-11,45,42,39,45,39,35,100,89,68,29.83,29.72,29.65,10,6,1,18,12,25,1.29,8,Rain,126
2014-3-12,44,40,37,37,35,32,96,84,71,30.06,29.91,29.70,10,9,7,20,9,21,0.09,7,Rain,155
2014-3-13,45,42,39,34,32,30,82,67,58,30.01,29.72,29.32,10,10,4,20,13,26,0.04,8,Rain,113
2014-3-14,44,39,35,40,35,29,93,84,58,29.89,29.64,29.27,10,8,2,17,11,28,0.37,8,Rain-Snow,157
2014-3-15,43,39,35,37,33,29,93,80,58,29.85,29.48,29.37,10,9,6,17,8,24,0.32,8,Rain,48
2014-3-16,39,36,34,36,30,21,93,79,49,30.00,29.74,29.45,10,9,5,22,14,,0.12,7,Rain-Snow,317
2014-3-17,43,39,35,38,35,28,89,83,76,30.01,29.96,29.88,10,9,4,14,10,,0.22,8,Rain-Snow,130
2014-3-18,39,36,34,36,34,31,97,87,73,29.95,29.69,29.54,10,7,2,21,10,,0.55,8,Rain-Snow,343
2014-3-19,42,37,32,35,33,30,100,90,70,30.10,29.93,29.82,10,8,2,13,6,,0.10,6,Rain-Snow,112
2014-3-20,42,34,28,34,31,28,96,85,67,30.33,30.26,30.12,10,10,10,9,3,,0.00,2,,212
2014-3-21,44,36,30,30,26,21,92,65,47,30.33,30.22,30.13,10,10,10,22,8,29,0.00,4,,99
2014-3-22,45,39,34,26,19,16,60,45,32,30.37,30.26,30.15,10,10,10,14,8,,0.00,2,,92
2014-3-23,44,36,30,17,13,9,54,38,28,30.38,30.32,30.24,10,10,10,16,8,22,0.00,0,,93
2014-3-24,43,40,37,23,11,3,49,30,23,30.22,29.96,29.70,10,10,10,20,12,29,0.00,6,,76
2014-3-25,46,42,37,27,23,20,60,48,42,29.68,29.59,29.51,10,10,10,17,8,24,0.00,5,,86
2014-3-26,44,42,39,26,22,16,58,47,36,29.73,29.65,29.54,10,10,10,13,5,17,0.00,8,,96
2014-3-27,44,40,37,25,20,16,57,45,37,29.76,29.75,29.73,10,10,10,16,8,,0.00,6,,91
2014-3-28,48,38,30,25,20,16,67,49,33,29.76,29.63,29.54,10,10,10,16,4,,0.00,1,,351
2014-3-29,51,42,33,28,22,18,70,48,28,29.69,29.62,29.57,10,10,10,12,4,,0.00,2,,8
2014-3-30,50,42,35,34,28,24,70,60,42,29.99,29.83,29.70,10,10,10,8,3,,0.00,3,,334
2014-3-31,48,42,35,38,33,30,82,72,56,30.07,30.03,29.99,10,10,10,20,4,,0.00,2,,312
2014-4-1,42,38,35,33,32,30,89,80,70,30.00,29.93,29.89,10,10,10,10,3,,0.00,7,,167
2014-4-2,42,38,33,36,33,32,96,86,70,29.89,29.76,29.68,10,10,7,10,3,,0.08,7,Rain,103
2014-4-3,45,38,32,34,32,30,96,78,58,29.75,29.73,29.69,10,10,10,16,4,,0.00,4,,348
2014-4-4,44,37,30,35,30,25,89,71,47,29.72,29.65,29.54,10,10,5,17,6,24,0.08,7,Rain,114
2014-4-5,45,42,39,40,37,34,97,87,76,29.75,29.59,29.50,10,8,4,17,9,23,0.59,8,Rain,123
2014-4-6,48,42,39,40,37,34,93,79,61,29.88,29.76,29.44,10,9,5,18,8,24,0.16,8,Rain,124
2014-4-7,48,44,39,43,40,36,96,88,71,29.48,29.37,29.22,10,4,1,31,18,45,1.15,8,Rain,160
2014-4-8,45,41,37,38,36,33,93,83,70,29.77,29.68,29.49,10,9,2,20,11,30,0.28,8,Rain,202
2014-4-9,42,38,36,39,36,33,100,87,73,29.81,29.68,29.53,10,8,2,22,8,26,0.47,8,Rain,134
2014-4-10,43,40,37,39,35,27,97,83,60,29.83,29.77,29.68,10,8,2,16,5,16,0.07,8,Rain,280
2014-4-11,50,40,33,32,28,22,92,62,39,30.32,30.14,29.85,10,10,10,22,12,22,0.00,0,,338
2014-4-12,46,38,30,36,31,27,85,72,53,30.35,30.33,30.30,10,10,10,7,3,,0.00,1,,190
2014-4-13,46,40,35,34,31,28,82,68,52,30.31,30.24,30.09,10,10,10,6,2,,0.00,6,,239
2014-4-14,46,42,39,42,39,33,93,86,73,30.07,29.86,29.79,10,10,8,10,3,,0.10,8,Rain,302
2014-4-15,45,44,42,42,40,39,97,89,82,29.93,29.89,29.82,10,9,4,10,3,,0.10,8,Rain,250
2014-4-16,53,46,41,40,36,32,96,68,47,29.91,29.69,29.40,10,10,10,14,6,21,0.01,7,,104
2014-4-17,48,45,42,42,39,34,92,80,63,29.57,29.39,29.28,10,10,5,12,8,,0.07,8,Rain,312
2014-4-18,48,44,39,40,37,30,93,79,48,29.80,29.72,29.59,10,9,4,15,8,,0.38,6,Rain,126
2014-4-19,52,49,46,37,32,28,66,52,44,29.57,29.38,29.29,10,10,10,24,17,39,0.00,6,Rain,102
2014-4-20,53,48,44,39,36,33,82,67,50,29.78,29.70,29.43,10,10,9,20,14,30,0.07,8,Rain,121
2014-4-21,46,44,37,38,36,34,86,73,61,30.04,29.94,29.78,10,10,10,17,10,24,0.00,5,Rain,157
2014-4-22,50,42,35,40,36,32,92,81,63,29.95,29.80,29.74,10,10,10,22,8,,0.00,3,,321
2014-4-23,46,43,41,39,38,37,93,82,74,29.78,29.75,29.69,10,10,8,12,8,,0.00,7,,298
2014-4-24,50,44,39,39,36,34,89,78,66,29.81,29.71,29.68,10,10,10,20,7,,0.00,5,,310
2014-4-25,50,42,37,39,37,34,89,77,63,29.84,29.77,29.63,10,10,10,12,6,,0.00,2,,288
2014-4-26,53,47,42,38,34,30,82,58,45,29.61,29.47,29.39,10,10,10,21,9,31,0.00,6,,105
2014-4-27,48,46,42,41,39,33,89,76,54,29.73,29.51,29.37,10,10,5,16,11,23,0.04,7,Rain,175
2014-4-28,50,46,42,41,38,35,92,77,57,29.91,29.87,29.75,10,10,10,18,6,30,0.01,8,Rain,98
2014-4-29,50,46,42,41,38,35,86,75,61,30.29,30.16,29.88,10,10,4,22,14,36,0.19,5,Rain,168
2014-4-30,57,47,39,42,38,36,93,71,49,30.38,30.29,30.24,10,10,10,13,2,,0.00,2,,275
2014-5-1,68,54,41,42,34,24,86,53,20,30.38,30.22,30.00,10,10,10,13,3,22,0.00,0,,36
2014-5-2,71,62,55,31,24,19,40,23,16,29.99,29.97,29.94,10,10,10,17,6,24,0.00,1,,99
2014-5-3,66,57,48,30,20,11,48,25,12,29.99,29.96,29.91,10,10,10,17,5,23,0.00,0,,69
2014-5-4,60,49,41,44,36,25,86,62,44,30.00,29.97,29.93,10,10,10,10,3,,0.00,0,,227
2014-5-5,51,48,44,43,41,39,86,79,71,30.12,30.04,29.96,10,10,10,18,9,,0.00,7,,312
2014-5-6,51,48,44,40,39,37,82,73,63,30.12,30.08,30.00,10,10,10,12,7,,0.00,5,,267
2014-5-7,53,48,44,41,37,30,82,65,44,29.99,29.85,29.76,10,10,9,15,4,21,0.00,7,,247
2014-5-8,57,50,44,45,42,39,93,76,53,29.76,29.70,29.67,10,10,9,8,4,,0.05,7,Rain,311
2014-5-9,61,52,43,47,44,40,93,76,60,29.99,29.79,29.68,10,10,10,18,4,,0.00,0,,300
2014-5-10,52,50,48,45,44,42,87,82,77,30.23,30.15,30.01,10,10,10,12,7,,0.00,7,,277
2014-5-11,48,47,46,43,42,41,83,80,77,30.29,30.26,30.24,10,10,10,7,3,,0.00,8,,245
2014-5-12,57,51,45,46,44,41,93,73,55,30.27,30.23,30.20,10,10,10,13,5,,0.01,7,Rain,111
2014-5-13,59,54,50,52,48,46,89,79,67,30.24,30.17,30.09,10,10,7,18,5,24,0.10,8,Rain,141
2014-5-14,52,50,48,48,47,45,93,88,83,30.34,30.22,30.15,10,10,8,10,6,,0.01,8,Rain,241
2014-5-15,57,52,48,48,47,44,96,86,67,30.35,30.27,30.13,10,10,8,8,2,,0.00,5,Rain,232
2014-5-16,70,57,46,48,44,40,90,62,42,30.11,29.97,29.88,10,10,10,9,3,,0.00,0,,211
2014-5-17,57,54,50,49,48,46,96,84,72,29.96,29.95,29.89,10,9,2,14,7,,0.00,6,,261
2014-5-18,51,49,48,48,46,44,100,90,80,29.95,29.91,29.81,10,8,1,10,6,,0.00,8,,218
2014-5-19,51,50,46,46,44,41,93,83,71,29.82,29.77,29.72,10,9,3,21,10,30,0.03,8,Rain,180
2014-5-20,51,48,45,43,42,40,86,80,74,29.94,29.86,29.82,10,10,6,14,9,20,0.12,8,Rain,150
2014-5-21,57,50,44,44,41,37,90,73,55,29.94,29.83,29.72,10,10,10,16,7,,0.04,6,Rain,346
2014-5-22,59,49,41,45,42,38,89,74,60,29.73,29.68,29.63,10,10,10,22,6,,0.00,3,,313
2014-5-23,57,50,44,46,43,41,93,77,62,30.06,29.90,29.73,10,10,10,13,5,,0.00,3,,219
2014-5-24,55,50,46,45,43,41,86,78,62,30.10,30.07,30.03,10,10,10,9,3,,0.00,4,,159
2014-5-25,64,54,44,47,41,39,90,65,43,30.02,29.97,29.92,10,10,10,17,5,,0.00,2,,308
2014-5-26,57,51,45,45,43,39,82,71,62,30.23,30.10,29.97,10,10,10,21,10,,0.00,4,,322
2014-5-27,54,52,50,43,41,39,77,70,57,30.33,30.29,30.23,10,10,10,15,10,,0.00,8,,312
2014-5-28,52,50,48,47,44,41,93,80,71,30.30,30.23,30.15,10,9,3,7,4,,0.00,8,,240
2014-5-29,57,52,48,48,47,46,100,88,72,30.19,30.15,30.13,10,8,2,9,2,,0.03,8,Rain,234
2014-5-30,53,52,50,49,48,45,92,88,77,30.19,30.13,30.07,10,9,2,15,5,21,0.07,8,Rain,201
2014-5-31,53,50,46,50,47,39,100,89,63,30.35,30.20,30.08,10,6,1,16,8,24,0.24,8,Rain,191
2014-6-1,55,50,45,45,41,37,93,74,57,30.36,30.33,30.27,10,10,10,16,5,,0.00,6,,299
2014-6-2,55,50,46,46,45,43,93,85,71,30.26,30.22,30.19,10,9,3,20,6,,0.05,8,Rain,286
2014-6-3,50,47,44,44,43,41,93,82,74,30.19,30.15,30.14,10,9,4,13,4,,0.14,7,Rain,306
2014-6-4,60,51,45,49,45,42,97,86,70,30.30,30.23,30.18,10,8,2,9,2,,0.00,8,,222
2014-6-5,55,50,46,45,44,42,90,77,66,30.29,30.26,30.19,10,10,10,13,4,,0.00,4,,215
2014-6-6,59,52,44,48,44,41,93,74,55,30.18,30.11,30.02,10,10,10,7,3,,0.02,3,Rain,320
2014-6-7,55,52,50,53,50,45,97,92,77,30.01,29.96,29.88,10,6,2,15,6,20,0.42,8,Rain,217
2014-6-8,54,50,48,48,46,45,93,85,76,29.97,29.88,29.82,10,8,2,17,10,24,0.74,8,Rain,160
2014-6-9,57,52,48,49,47,46,97,87,74,30.12,30.06,29.97,10,9,4,12,6,,0.35,8,Rain,148
2014-6-10,59,52,48,48,47,45,97,84,64,30.16,30.14,30.12,10,10,5,10,5,,0.01,6,Rain,124
2014-6-11,59,51,45,47,45,43,93,75,58,30.12,30.10,30.08,10,10,10,16,5,,0.00,5,,326
2014-6-12,57,54,52,45,44,42,77,68,57,30.09,30.07,30.06,10,10,10,20,11,,0.00,5,,306
2014-6-13,54,50,48,48,45,43,97,81,67,30.07,29.88,29.74,10,8,2,16,7,18,0.29,8,Rain,139
2014-6-14,55,50,48,48,46,42,94,86,69,29.78,29.75,29.72,10,8,3,15,9,21,0.57,8,Rain,144
2014-6-15,59,52,48,50,47,44,93,81,67,29.95,29.85,29.78,10,10,10,13,7,,0.24,6,Rain,337
2014-6-16,59,52,45,49,47,44,97,82,64,30.01,29.99,29.93,10,10,10,12,4,,0.00,4,Rain,226
2014-6-17,57,52,48,51,48,44,97,87,74,29.96,29.84,29.74,10,6,1,20,11,29,0.95,8,Rain,173
2014-6-18,55,50,46,46,45,42,93,84,69,30.03,29.98,29.95,10,9,2,13,6,,0.41,7,Rain,117
2014-6-19,59,52,44,48,45,42,96,81,57,29.96,29.83,29.70,10,10,7,13,5,,0.12,6,Rain,283
2014-6-20,57,52,48,48,46,42,93,85,64,29.94,29.78,29.67,10,9,2,14,5,,0.15,7,Rain,138
2014-6-21,60,56,52,46,43,41,75,64,55,29.90,29.84,29.73,10,10,10,17,11,22,0.01,7,Rain,113
2014-6-22,57,55,53,53,49,43,97,81,58,29.85,29.78,29.62,10,10,8,21,12,30,0.15,8,Rain,143
2014-6-23,57,54,52,55,53,52,100,97,88,29.86,29.83,29.76,10,6,0,7,2,,0.41,8,Fog-Rain,289
2014-6-24,54,52,50,54,51,48,100,95,86,30.07,29.93,29.76,10,6,1,20,5,21,0.36,8,Rain,190
2014-6-25,55,52,48,49,46,43,93,82,66,30.07,30.03,29.88,10,10,7,15,7,21,0.05,8,Rain,142
2014-6-26,59,54,48,49,46,44,93,77,58,29.86,29.69,29.57,10,10,10,10,5,,0.00,3,,287
2014-6-27,64,56,50,49,47,44,86,69,55,29.57,29.55,29.53,10,10,10,10,4,,0.00,5,,290
2014-6-28,66,59,54,53,51,47,90,79,63,29.85,29.71,29.59,10,10,10,9,5,,0.00,7,,294
2014-6-29,63,57,52,55,53,50,96,88,70,30.12,30.01,29.86,10,10,6,13,3,,0.19,7,Rain,228
2014-6-30,57,55,53,53,52,50,97,92,83,30.22,30.19,30.12,10,8,2,14,6,16,0.12,8,Rain,216
2014-7-1,64,56,50,53,51,48,96,83,58,30.19,30.00,29.79,10,10,10,7,4,,0.00,7,,337
2014-7-2,71,62,55,55,52,46,96,80,51,29.81,29.75,29.66,10,9,2,13,5,,0.14,7,Rain,327
2014-7-3,64,58,53,55,53,51,97,85,72,29.88,29.86,29.81,10,10,8,15,4,,0.01,6,,258
2014-7-4,59,56,52,52,51,50,96,88,75,29.91,29.89,29.87,10,9,2,9,2,,0.07,7,Rain,255
2014-7-5,69,59,50,52,50,46,96,72,49,29.88,29.82,29.79,10,10,10,13,5,,0.00,6,,110
2014-7-6,62,58,55,51,50,46,80,71,58,30.13,30.07,29.89,10,10,10,20,10,29,0.00,6,Rain,213
2014-7-7,61,57,55,56,53,51,96,87,75,30.10,30.07,30.05,10,9,4,16,4,25,0.14,8,Rain,211
2014-7-8,55,54,53,54,53,51,100,94,86,30.10,30.06,30.04,10,6,2,12,5,23,0.84,8,Rain,159
2014-7-9,57,55,53,56,54,52,100,96,83,30.24,30.18,30.11,10,7,2,9,5,,0.13,8,Rain,201
2014-7-10,61,56,53,53,52,51,100,90,75,30.23,30.17,30.03,10,8,2,8,3,,0.03,8,Rain,215
2014-7-11,57,56,54,56,54,51,100,94,84,30.02,30.00,29.98,10,5,2,12,5,,1.28,8,Rain,250
2014-7-12,59,56,55,58,56,55,100,97,93,30.18,30.06,29.99,10,6,2,15,7,26,0.32,8,Rain,275
2014-7-13,57,56,55,58,56,55,100,98,94,30.25,30.22,30.18,10,5,1,8,4,,0.29,8,Rain,291
2014-7-14,61,58,55,58,56,51,100,94,83,30.24,30.23,30.22,10,7,0,16,4,,0.01,8,Fog,307
2014-7-15,64,58,55,53,51,48,93,78,64,30.27,30.25,30.24,10,10,10,17,12,,0.00,6,,318
2014-7-16,61,56,52,51,49,47,89,76,64,30.27,30.23,30.16,10,10,10,15,6,,0.00,6,,294
2014-7-17,59,55,51,52,50,48,93,84,75,30.16,30.04,29.82,10,10,6,9,3,,0.11,7,Rain,232
2014-7-18,63,56,51,54,52,50,100,84,67,29.79,29.69,29.65,10,10,7,10,5,,0.05,6,Rain,299
2014-7-19,60,57,54,55,53,51,97,88,75,29.91,29.82,29.68,10,9,2,9,2,,0.00,8,,292
2014-7-20,57,55,52,54,52,50,94,89,77,29.92,29.87,29.78,10,8,2,13,4,,0.31,8,Rain,155
2014-7-21,69,60,52,53,51,50,97,77,52,29.99,29.88,29.78,10,10,10,13,4,,0.00,5,,297
2014-7-22,63,59,55,56,54,52,90,84,77,30.11,30.04,29.99,10,10,10,9,3,,0.00,6,Rain,240
2014-7-23,62,58,55,54,52,50,87,80,72,30.10,30.03,29.96,10,10,10,8,3,,0.00,7,,230
2014-7-24,59,57,54,54,52,51,94,84,78,29.95,29.91,29.89,10,9,3,17,4,28,0.06,8,Rain,207
2014-7-25,57,55,53,55,53,51,100,92,81,29.91,29.87,29.83,10,8,2,13,3,,0.53,8,Rain,141
2014-7-26,57,55,53,57,55,54,100,96,93,29.96,29.91,29.87,10,8,1,15,5,24,0.57,8,Rain,216
2014-7-27,61,58,55,55,54,53,100,92,78,30.10,30.05,29.97,10,9,2,13,5,,0.30,8,Rain,213
2014-7-28,59,56,53,57,54,51,97,94,90,30.06,30.00,29.96,10,8,2,9,3,,0.61,8,Rain,261
2014-7-29,61,56,51,54,52,49,96,89,75,30.13,30.02,29.95,10,9,3,14,4,,0.25,6,Rain,153
2014-7-30,61,57,54,55,53,52,97,88,78,30.31,30.23,30.14,10,10,8,8,4,,0.08,7,Rain,160
2014-7-31,66,58,50,55,52,49,100,86,65,30.31,30.29,30.26,10,9,3,10,4,,0.00,3,,217
2014-8-1,69,60,51,56,53,49,93,79,63,30.27,30.21,30.15,10,10,10,10,4,,0.00,1,,298
2014-8-2,66,58,52,55,53,51,97,86,68,30.15,30.11,30.09,10,9,0,9,4,,0.00,2,Fog,266
2014-8-3,64,58,52,58,54,49,93,83,75,30.12,30.08,29.95,10,10,10,9,5,,0.00,7,,317
2014-8-4,64,60,57,59,56,52,96,85,75,30.03,29.98,29.90,10,9,7,23,8,36,0.08,6,Rain,208
2014-8-5,66,58,53,56,53,50,94,82,70,30.08,30.04,30.01,10,10,4,13,6,18,0.03,7,Rain,178
2014-8-6,63,59,55,55,54,50,96,86,72,30.16,30.12,30.08,10,8,2,10,5,,0.43,7,Rain,135
2014-8-7,63,56,50,53,51,48,93,80,67,30.09,29.98,29.93,10,10,10,10,4,,0.00,5,,329
2014-8-8,64,58,55,55,53,51,93,84,70,30.01,29.99,29.95,10,9,3,12,4,16,0.20,8,Rain,133
2014-8-9,61,59,57,57,54,50,97,81,69,29.93,29.83,29.78,10,7,3,17,10,25,1.24,8,Rain,125
2014-8-10,62,60,57,61,59,56,100,95,86,29.98,29.85,29.77,10,4,1,16,8,22,3.80,8,Rain,148
2014-8-11,64,62,59,62,59,58,100,96,90,29.99,29.91,29.83,10,6,1,16,5,28,0.50,8,Fog-Rain,290
2014-8-12,64,60,57,59,57,54,100,91,75,30.01,29.93,29.84,10,8,2,21,12,29,0.04,8,Rain,209
2014-8-13,60,58,55,58,56,53,97,92,84,30.01,29.98,29.94,10,7,2,9,4,,0.28,8,Rain,126
2014-8-14,64,60,57,58,57,55,100,92,80,30.02,29.99,29.91,10,8,2,14,6,22,0.42,7,Rain,150
2014-8-15,63,58,55,59,56,53,100,93,80,30.10,29.96,29.87,10,7,1,14,4,,1.20,7,Rain,210
2014-8-16,63,58,52,55,53,50,96,85,75,30.16,30.13,30.08,10,10,7,16,7,21,0.06,5,Rain,141
2014-8-17,62,58,55,59,55,51,97,89,81,30.07,29.97,29.88,10,5,1,24,12,38,2.26,8,Rain,153
2014-8-18,63,58,55,56,55,53,97,91,75,30.03,30.00,29.98,10,8,2,14,6,,0.46,8,Rain,201
2014-8-19,63,58,52,55,53,48,100,88,67,30.02,30.01,29.99,10,9,4,9,3,,0.09,7,Fog-Rain,276
2014-8-20,66,56,48,54,51,46,97,83,61,30.02,29.98,29.97,10,10,10,8,2,,0.00,0,,165
2014-8-21,70,60,50,57,54,49,100,82,61,30.19,30.11,30.03,10,10,10,16,4,,0.00,0,,280
2014-8-22,64,60,55,55,54,53,94,85,67,30.23,30.21,30.17,10,10,10,10,7,,0.00,5,Rain,324
2014-8-23,64,59,55,55,54,53,97,85,72,30.18,30.16,30.14,10,10,9,14,5,,0.01,6,Rain,328
2014-8-24,57,56,55,56,55,53,100,94,87,30.16,30.01,29.87,10,8,2,15,5,,0.26,8,Rain,138
2014-8-25,59,56,53,58,57,53,100,98,87,29.95,29.91,29.87,10,6,2,12,6,,0.22,8,Rain,176
2014-8-26,57,55,53,55,53,50,100,94,84,30.01,29.96,29.91,10,8,1,17,7,23,0.73,8,Rain,142
2014-8-27,62,56,51,54,52,50,100,93,75,30.12,30.07,30.01,10,10,6,7,5,,0.02,6,Rain,122
2014-8-28,61,56,50,50,48,46,96,79,62,30.06,29.90,29.67,10,10,10,14,7,21,0.00,6,Rain,125
2014-8-29,59,54,51,53,50,46,100,83,67,29.65,29.52,29.47,10,10,5,14,10,21,0.41,8,Rain,112
2014-8-30,61,54,48,55,52,48,100,94,83,29.75,29.68,29.54,10,9,4,12,3,20,0.13,7,Rain,147
2014-8-31,55,52,50,54,52,50,100,97,89,29.73,29.68,29.65,10,8,4,12,6,,0.55,8,Rain,97
2014-9-1,57,54,48,54,52,48,100,94,77,29.95,29.77,29.67,10,8,2,9,4,,0.35,7,Rain,215
2014-9-2,62,54,48,53,51,49,100,92,69,30.09,30.05,29.96,10,10,6,10,4,,0.01,6,Rain,112
2014-9-3,57,54,52,55,53,50,100,95,83,30.18,30.14,30.08,10,9,2,13,4,,0.07,8,Rain,120
2014-9-4,57,54,52,57,54,51,100,98,87,30.19,30.16,30.13,10,6,1,13,5,20,0.44,8,Rain,152
2014-9-5,60,56,54,57,55,50,100,96,78,30.25,30.20,30.17,10,5,1,16,11,23,0.10,8,Rain,185
2014-9-6,57,55,53,57,56,50,100,99,80,30.15,29.95,29.88,10,3,1,14,8,24,3.44,8,Rain,173
2014-9-7,57,54,50,56,54,50,100,98,87,29.97,29.89,29.86,10,8,2,12,4,,0.19,8,Fog-Rain,274
2014-9-8,57,50,46,53,50,46,100,96,83,30.13,30.05,29.99,10,8,0,8,2,,0.00,4,,152
2014-9-9,57,52,46,53,50,46,100,93,77,30.25,30.21,30.14,10,10,10,6,2,,0.00,3,,86
2014-9-10,63,56,50,53,48,43,94,77,48,30.24,30.21,30.19,10,9,3,13,5,,0.04,7,Rain,91
2014-9-11,57,55,53,55,54,51,100,97,90,30.35,30.27,30.20,10,6,2,10,5,,0.28,8,Rain,223
2014-9-12,59,55,53,54,52,51,100,90,81,30.35,30.31,30.22,10,10,8,7,2,,0.01,8,Rain,148
2014-9-13,61,58,55,56,55,53,97,93,86,30.22,30.14,30.06,10,9,3,7,2,,0.00,7,,210
2014-9-14,57,55,53,54,53,52,100,92,83,30.06,30.00,29.93,10,9,2,8,3,,0.00,8,Rain,154
2014-9-15,61,56,53,57,54,51,100,93,81,29.95,29.91,29.87,10,10,6,8,4,,0.04,8,Rain,175
2014-9-16,62,58,53,57,55,52,100,95,75,29.88,29.86,29.81,10,6,2,14,6,,0.13,7,Rain,317
2014-9-17,57,52,48,51,49,46,100,88,72,29.82,29.70,29.51,10,10,10,8,2,,0.00,5,,74
2014-9-18,60,58,55,54,50,45,89,76,62,29.48,29.25,29.11,10,8,2,28,16,45,0.76,8,Rain,139
2014-9-19,59,56,53,54,52,49,100,88,75,29.87,29.60,29.28,10,7,2,28,17,40,0.84,8,Rain,173
2014-9-20,61,56,51,56,52,47,100,90,72,29.78,29.68,29.48,10,8,3,22,8,30,0.29,8,Rain,185
2014-9-21,64,58,52,55,51,48,100,84,58,29.64,29.41,29.23,10,8,2,34,12,50,0.78,8,Rain,147
2014-9-22,57,52,46,51,49,46,97,89,72,29.87,29.77,29.64,10,10,4,15,8,21,0.91,7,Rain,115
2014-9-23,62,54,46,49,48,46,100,87,62,29.87,29.72,29.51,10,10,10,8,3,,0.00,4,,336
2014-9-24,62,55,48,48,44,41,89,67,46,29.65,29.54,29.46,10,10,10,7,3,,0.00,6,,29
2014-9-25,57,55,53,53,51,45,97,89,62,29.82,29.75,29.66,10,9,3,14,4,21,0.47,8,Rain,329
2014-9-26,62,57,52,53,52,49,100,86,64,29.83,29.81,29.78,10,10,10,13,5,,0.00,7,Rain,343
2014-9-27,61,56,52,54,51,48,100,81,64,29.77,29.68,29.48,10,9,6,18,12,29,0.31,8,Rain,128
2014-9-28,57,54,50,54,52,49,100,91,77,29.60,29.53,29.47,10,8,2,17,11,23,0.74,8,Rain,125
2014-9-29,57,50,45,52,49,45,100,93,83,29.82,29.71,29.60,10,10,9,8,4,,0.03,6,Rain,132
2014-9-30,54,49,44,50,45,38,100,84,59,30.00,29.87,29.76,10,9,2,29,8,36,0.45,8,Rain,237
2014-10-1,54,46,37,48,37,24,100,74,32,30.26,30.08,29.82,10,10,5,29,6,36,0.11,4,Rain,23
2014-10-2,55,46,39,45,34,26,76,62,41,30.22,29.87,29.49,10,10,7,29,11,41,0.14,6,Rain,103
2014-10-3,57,54,52,54,52,44,100,90,69,29.66,29.48,29.43,10,6,2,32,19,50,1.37,8,Rain,170
2014-10-4,55,52,50,53,49,43,100,91,66,30.01,29.85,29.67,10,8,2,20,11,24,0.17,7,Rain,181
2014-10-5,55,52,48,52,46,36,96,78,59,29.92,29.70,29.47,10,9,2,26,15,40,0.23,7,Rain,184
2014-10-6,48,46,42,43,41,39,97,88,71,30.08,30.04,29.94,10,10,5,13,7,,0.15,7,Rain,105
2014-10-7,46,42,37,43,40,37,100,91,79,30.06,30.00,29.96,10,9,4,12,5,,0.16,7,Rain,68
2014-10-8,48,42,35,41,38,35,100,87,61,30.00,29.92,29.75,10,10,10,9,4,,0.02,5,Rain,12
2014-10-9,55,49,43,53,49,41,100,90,77,29.74,29.53,29.28,10,7,3,24,11,30,1.18,8,Rain,127
2014-10-10,54,51,48,52,50,47,100,95,86,29.40,29.35,29.27,10,6,2,26,14,41,1.45,8,Rain,141
2014-10-11,51,50,48,51,49,47,100,97,88,29.78,29.58,29.34,10,6,1,16,10,30,0.93,8,Rain-Thunderstorm,172
2014-10-12,53,50,46,50,47,42,100,94,69,29.79,29.59,29.42,10,8,2,18,8,21,0.45,8,Rain,142
2014-10-13,53,45,39,45,42,38,100,86,61,29.60,29.31,29.02,10,9,2,24,8,30,0.12,5,Rain,77
2014-10-14,51,48,46,39,37,35,74,66,59,29.42,29.36,29.24,10,10,10,18,13,26,0.00,4,Rain,108
2014-10-15,54,51,48,43,40,35,74,65,56,29.45,29.35,29.28,10,10,10,21,13,31,0.00,5,Rain,119
2014-10-16,52,48,46,45,41,38,93,74,63,29.58,29.52,29.45,10,10,9,20,13,25,0.09,7,Rain,115
2014-10-17,55,46,37,44,40,37,97,83,55,29.53,29.29,29.17,10,10,10,14,2,,0.06,4,Rain,58
2014-10-18,52,48,44,47,44,41,100,88,69,29.34,29.25,29.15,10,9,3,17,8,23,0.42,8,Rain,113
2014-10-19,51,48,45,47,45,44,100,92,80,29.24,29.08,28.93,10,8,2,14,9,,0.51,8,Rain,115
2014-10-20,50,45,42,48,45,39,100,91,80,29.36,29.27,29.16,10,9,3,12,8,,0.27,7,Rain,116
2014-10-21,52,48,46,42,40,36,79,71,59,29.32,29.09,28.99,10,10,10,21,12,31,0.00,6,Rain,113
2014-10-22,50,44,39,43,41,38,100,83,66,29.38,29.25,28.99,10,9,5,23,15,34,0.25,6,Rain,110
2014-10-23,48,44,39,43,39,37,96,80,66,29.75,29.54,29.34,10,10,10,13,6,,0.00,4,,84
2014-10-24,46,41,36,42,39,35,97,90,76,29.83,29.80,29.77,10,10,9,9,3,,0.05,4,Rain,30
2014-10-25,50,42,37,43,39,37,100,90,77,29.80,29.72,29.66,10,10,10,12,4,,0.00,1,,6
2014-10-26,46,42,37,43,40,37,100,95,79,29.91,29.86,29.75,10,10,7,8,3,,0.16,6,Rain,98
2014-10-27,50,44,37,42,38,33,100,85,57,29.90,29.75,29.52,10,10,9,15,5,,0.13,4,Rain,62
2014-10-28,45,41,37,40,36,31,96,80,60,29.56,29.44,29.37,10,10,10,6,1,,0.01,7,Rain,66
2014-10-29,50,45,42,40,38,36,92,74,66,29.74,29.66,29.52,10,10,10,16,10,,0.02,8,Rain,116
2014-10-30,48,44,39,45,40,37,100,93,69,29.51,29.48,29.45,10,9,2,21,11,30,0.39,7,Rain,114
2014-10-31,43,41,39,39,38,37,97,89,80,29.54,29.51,29.39,10,8,2,21,12,28,1.28,8,Rain,114
2014-11-1,46,44,41,43,41,39,96,90,85,29.47,29.42,29.33,10,8,3,23,16,33,1.32,8,Rain,115
2014-11-2,46,42,39,41,40,37,100,90,74,29.82,29.68,29.48,10,9,3,25,12,34,0.43,7,Rain,119
2014-11-3,46,41,36,40,36,29,100,81,50,29.82,29.42,29.16,10,9,5,16,8,24,0.36,7,Rain,97
2014-11-4,45,41,37,41,39,36,100,91,74,29.93,29.66,29.34,10,8,2,26,13,36,1.00,8,Rain-Thunderstorm,143
2014-11-5,45,40,35,38,36,31,100,85,58,29.92,29.46,29.08,10,9,7,20,10,25,0.41,7,Rain,50
2014-11-6,46,40,35,40,37,35,100,89,68,29.86,29.69,29.45,10,10,4,15,9,24,0.16,6,Rain,104
2014-11-7,50,48,45,42,37,34,86,68,63,29.98,29.90,29.79,10,10,7,23,16,34,0.21,7,Rain,110
2014-11-8,48,42,37,43,41,37,100,90,80,30.08,30.00,29.97,10,8,2,18,11,23,0.66,6,Rain,96
2014-11-9,44,40,36,40,39,35,100,94,82,30.32,30.24,30.10,10,10,7,6,2,,0.00,4,Rain,85
2014-11-10,44,40,35,42,39,34,100,96,89,30.35,30.33,30.31,10,10,10,9,4,,0.01,5,Rain,93
2014-11-11,44,38,33,38,34,32,100,93,73,30.32,30.31,30.29,10,10,10,6,2,,0.00,0,,67
2014-11-12,43,36,30,35,30,27,100,88,65,30.32,30.24,30.17,10,10,10,6,2,,0.00,0,,88
2014-11-13,43,36,28,33,29,26,92,83,60,30.18,30.14,30.12,10,10,10,7,3,,0.00,0,,90
2014-11-14,43,36,28,32,29,26,96,83,56,30.30,30.24,30.19,10,10,10,6,1,,0.00,1,,102
2014-11-15,43,36,28,33,28,26,92,79,65,30.39,30.36,30.29,10,10,10,7,1,,0.00,0,,21
2014-11-16,43,38,34,41,34,26,96,80,58,30.38,30.35,30.32,10,10,6,10,5,,0.05,7,Rain,348
2014-11-17,45,41,37,43,42,38,100,98,89,30.34,30.23,29.94,10,6,1,10,5,,0.09,7,Rain,343
2014-11-18,52,48,43,47,39,29,100,72,41,29.93,29.79,29.73,10,9,5,26,14,37,0.59,6,Rain,110
2014-11-19,46,44,39,47,44,40,100,97,86,29.84,29.80,29.71,10,9,4,13,6,,0.30,8,Rain,329
2014-11-20,44,39,34,41,38,34,100,98,89,29.70,29.54,29.26,10,7,0,8,3,,0.01,6,Fog-Rain,41
2014-11-21,48,44,39,42,38,33,93,81,56,29.23,29.14,29.00,10,8,2,21,13,31,0.40,7,Rain,121
2014-11-22,43,40,37,39,38,37,97,91,80,29.53,29.37,29.24,10,8,2,14,9,,0.88,7,Rain,103
2014-11-23,42,40,37,39,38,36,100,94,82,29.78,29.68,29.54,10,9,2,15,6,,0.49,7,Rain,103
2014-11-24,43,41,39,41,39,36,100,92,82,30.04,29.81,29.62,10,9,3,16,8,20,0.30,7,Rain,141
2014-11-25,39,36,32,40,37,32,100,99,93,30.21,30.14,30.04,10,10,4,13,6,,0.20,6,Rain,89
2014-11-26,39,34,28,35,31,24,100,95,73,30.21,30.08,29.91,10,10,2,7,3,,0.00,1,,65
2014-11-27,36,32,28,20,9,3,54,38,32,30.05,29.93,29.89,10,10,10,25,12,40,0.00,0,,31
2014-11-28,32,28,25,17,6,-5,66,42,24,30.21,30.15,30.07,10,10,10,10,3,,0.00,2,,74
2014-11-29,36,32,28,36,30,17,100,86,59,30.12,30.10,30.05,10,8,2,10,3,,0.15,8,Rain-Snow,86
2014-11-30,37,34,32,36,34,32,100,98,93,30.04,29.90,29.84,10,8,2,12,7,,1.05,7,Rain,91
2014-12-1,36,33,30,35,32,30,100,96,81,30.01,29.95,29.86,10,9,2,10,3,,0.09,7,Rain-Snow,96
2014-12-2,45,40,36,44,41,36,100,96,89,30.01,29.97,29.93,10,7,3,21,8,23,1.15,8,Rain,166
2014-12-3,39,34,28,40,35,29,100,99,93,29.97,29.95,29.93,10,10,6,14,4,18,0.05,4,Rain,94
2014-12-4,37,32,28,32,30,26,100,87,70,29.95,29.87,29.80,10,10,7,10,4,,0.00,1,,5
2014-12-5,39,36,32,34,30,26,79,76,70,29.80,29.71,29.55,10,10,10,12,5,,0.00,5,,343
2014-12-6,45,40,37,40,38,34,100,97,74,29.82,29.67,29.53,10,9,3,14,4,,0.33,8,Rain,13
2014-12-7,50,48,45,39,37,35,74,64,59,29.81,29.56,29.33,10,10,10,25,19,39,0.03,6,Rain,117
2014-12-8,52,48,44,42,39,36,86,67,57,29.31,29.05,28.88,10,10,6,25,19,39,0.26,7,Rain,120
2014-12-9,45,43,41,43,41,39,100,95,81,29.11,28.88,28.74,10,9,5,15,8,,0.75,7,Rain,114
2014-12-10,45,40,36,42,38,36,100,91,71,29.16,28.92,28.75,10,10,10,16,5,25,0.00,6,Rain,46
2014-12-11,46,42,39,41,39,35,100,86,68,29.27,29.05,28.85,10,10,9,12,5,,0.04,6,Rain,52
2014-12-12,42,40,37,41,39,37,100,98,89,29.83,29.52,29.28,10,8,4,12,4,,0.63,8,Rain,103
2014-12-13,46,42,39,38,37,35,96,81,66,29.94,29.89,29.83,10,10,8,20,12,25,0.06,8,Rain,110
2014-12-14,48,47,46,36,35,34,68,62,56,29.85,29.70,29.57,10,10,10,28,23,41,0.07,8,Rain,116
2014-12-15,50,48,43,38,33,27,82,60,41,29.58,29.46,29.39,10,10,8,26,21,37,0.06,8,Rain,117
2014-12-16,44,40,37,38,36,33,93,85,71,29.67,29.56,29.52,10,9,4,18,10,24,0.39,7,Rain,119
2014-12-17,43,38,34,34,32,29,96,75,58,29.73,29.67,29.55,10,10,10,18,8,25,0.00,6,,81
2014-12-18,45,43,41,33,30,27,67,60,55,29.52,29.31,29.19,10,10,10,21,14,30,0.00,7,Rain,112
2014-12-19,46,44,42,35,33,30,74,65,60,29.26,29.16,29.01,10,10,10,21,15,31,0.01,6,Rain,117
2014-12-20,46,44,41,39,36,33,93,72,59,29.13,28.95,28.81,10,10,7,21,15,30,0.07,8,Rain,117
2014-12-21,42,40,37,40,38,37,100,94,85,29.79,29.44,29.14,10,10,9,10,6,,0.11,7,Rain,85
2014-12-22,45,42,39,41,38,32,97,85,67,30.10,29.97,29.71,10,9,4,23,8,22,0.15,7,Rain,130
(2)使用如上数据进行上述操作
只需更改filename变量名即图表标题即可:
(3)再绘制一个数据系列(添加最低气温数据)
import csv
from matplotlib import pyplot as plt
from datetime import datetime
'''处理大量数据时,同时画出多个折线!'''
filename = 'sitka_weather_2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
#for index,column_header in enumerate(header_row): #对列表调用enumerate()方法,获取每个元素的索引及其值
# print(index,column_header)
#获取日期和最高气温,最低气温
dates,highs,lows =[],[],[]
for row in reader: #依此循环csv文件的每一行
current_date = datetime.strptime(row[0],"%Y-%m-%d") #s取出每一行的下标为0的数据
dates.append(current_date)
high = int(row[1]) #循环的每一行为列表形式存在在row里,取出每一行的下标为1的数据
highs.append(high)
low = int(row[3])
lows.append(low)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize=(10,6)) #设置绘图窗口的尺寸
plt.plot(dates,highs,c='red')
plt.plot(dates,lows,c='blue')
#设置图形的格式
plt.title("Daily high and low temperatures - 2014", fontsize=24)
plt.xlabel('',fontsize=16)
fig.autofmt_xdate() #使x轴标签绘制为斜的日期标签,以免它们彼此重叠
plt.ylabel("Temperature(F)",fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()
(4)给图表区域着色
我们将使用方法fill_between(),它接收一个x值系列和两个y值系列,并填充两个y值系列之间的空间。
import csv
from matplotlib import pyplot as plt
from datetime import datetime
'''处理大量数据时,同时画出多个折线!'''
filename = 'sitka_weather_2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
#for index,column_header in enumerate(header_row): #对列表调用enumerate()方法,获取每个元素的索引及其值
# print(index,column_header)
#获取日期和最高气温,最低气温
dates,highs,lows =[],[],[]
for row in reader: #依此循环csv文件的每一行
current_date = datetime.strptime(row[0],"%Y-%m-%d") #s取出每一行的下标为0的数据
dates.append(current_date)
high = int(row[1]) #循环的每一行为列表形式存在在row里,取出每一行的下标为1的数据
highs.append(high)
low = int(row[3])
lows.append(low)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize=(10,6)) #设置绘图窗口的尺寸
plt.plot(dates,highs,c='red',alpha=0.5) #alpha设置颜色的透明度。0是完全透明;1是完全不透明
plt.plot(dates,lows,c='blue',alpha=0.5)
#fill_between()接收一个x值系列和两个y值系列,并填充两个y值系列之间的空间。
plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.1)
#设置图形的格式
plt.title("Daily high and low temperatures - 2014", fontsize=24)
plt.xlabel('',fontsize=16)
fig.autofmt_xdate() #使x轴标签绘制为斜的日期标签,以免它们彼此重叠
plt.ylabel("Temperature(F)",fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()
(5)错误检查
我们应该能够使用有关任何地方的天气数据来运行上述代码,但有些气象站会偶尔出现故障,未能收集部分或全部其应该收集的数据。缺失数据可能会引发异常!
比如气温数据中缺失某天的最高温度数据,即此数据中最高温度的字符串为空。这样上述代码运行就会报错!
为解决这种问题,我们在从CSV文件中读取值时执行错误检查代码,对分析数据集时可能出现的异常进行处理:
数据缺失举例:
2014-2-16,,,,,,,,,,,,,,,,,,,0.00,,,-1
import csv
from matplotlib import pyplot as plt
from datetime import datetime
'''如果有些日期部分数据缺失的话,之前的程序会报错无法正常运行!'''
filename = 'death_valley_2014.csv'
with open(filename) as f:
reader = csv.reader(f) #创建一个与该文件相关联的阅读器对象
header_row = next(reader) # 模块csv的reader类包含next()方法,表用时返回文件的下一行
#因为就调用一次next()方法,所以返回文件的第一行
#for index,column_header in enumerate(header_row): #对列表调用enumerate()方法,获取每个元素的索引及其值
# print(index,column_header)
#获取日期和最高气温,最低气温
dates,highs,lows =[],[],[]
for row in reader: #依此循环csv文件的每一行
try:
current_date = datetime.strptime(row[0],"%Y-%m-%d") #s取出每一行的下标为0的数据
high = int(row[1]) #循环的每一行为列表形式存在在row里,取出每一行的下标为1的数据
low = int(row[3])
except ValueError:
print(current_date,'missing data')
else:
highs.append(high)
dates.append(current_date)
lows.append(low)
#根据数据绘制图形
fig = plt.figure(dpi=128,figsize=(10,6)) #设置绘图窗口的尺寸
plt.plot(dates,highs,c='red',alpha=0.5) #alpha设置颜色的透明度。0是完全透明;1是完全不透明
plt.plot(dates,lows,c='blue',alpha=0.5)
#fill_between()接收一个x值系列和两个y值系列,并填充两个y值系列之间的空间。
plt.fill_between(dates,highs,lows,facecolor='blue',alpha=0.1)
#设置图形的格式
plt.title("Daily high and low temperatures - 2014\nDeath Valley,CA", fontsize=20)
plt.xlabel('',fontsize=16)
fig.autofmt_xdate() #使x轴标签绘制为斜的日期标签,以免它们彼此重叠
plt.ylabel("Temperature(F)",fontsize=16)
plt.tick_params(axis='both',which='major',labelsize=16)
plt.show()