การสำรวจชุดข้อมูลสภาพอากาศ

การวิเคราะห์กิจกรรมตำรวจด้วย pandas

Kevin Markham

Founder, Data School

แนะนำชุดข้อมูล

โลโก้ National Centers for Environmental Information

แผนที่สถานีวัดอากาศ

การวิเคราะห์กิจกรรมตำรวจด้วย pandas
weather = pd.read_csv('weather.csv')

weather.head(3)
       STATION        DATE  TAVG  TMIN  TMAX  AWND  WSF2  WT01  WT02
0  USW00014765  2005-01-01  44.0    35    53  8.95  25.1   1.0   NaN 
1  USW00014765  2005-01-02  36.0    28    44  9.40  14.1   NaN   NaN  
2  USW00014765  2005-01-03  49.0    44    53  6.93  17.0   1.0   NaN  

   ...   WT11  WT13  WT14  WT15  WT16  WT17  WT18  WT19  WT21  WT22  
0  ...    NaN   1.0   NaN   NaN   NaN   NaN   NaN   NaN   NaN   NaN  
1  ...    NaN   NaN   NaN   NaN   1.0   NaN   1.0   NaN   NaN   NaN  
2  ...    NaN   1.0   NaN   NaN   1.0   NaN   NaN   NaN   NaN   NaN
  • TAVG, TMIN, TMAX: อุณหภูมิ
  • AWND, WSF2: ความเร็วลม
  • WT01 ... WT22: สภาพอากาศเลวร้าย
การวิเคราะห์กิจกรรมตำรวจด้วย pandas

ตรวจสอบความเร็วลม

weather[['AWND', 'WSF2']].head()
   AWND  WSF2
0  8.95  25.1
1  9.40  14.1
2  6.93  17.0
3  6.93  16.1
4  7.83  17.0
weather[['AWND', 'WSF2']].describe()
              AWND         WSF2
count  4017.000000  4017.000000
mean      8.593707    19.274782
std       3.364601     5.623866
min       0.220000     4.900000
25%       6.260000    15.000000
50%       8.050000    17.900000
75%      10.290000    21.900000
max      26.840000    48.100000
การวิเคราะห์กิจกรรมตำรวจด้วย pandas

สร้าง box plot

weather[['AWND', 'WSF2']].plot(kind='box')
plt.show()

Box plot ของคอลัมน์ความเร็วลม

การวิเคราะห์กิจกรรมตำรวจด้วย pandas

สร้าง histogram (1)

weather['WDIFF'] = weather.WSF2 - weather.AWND

weather.WDIFF.plot(kind='hist') plt.show()

Histogram ของความแตกต่างด้านความเร็วลม

การวิเคราะห์กิจกรรมตำรวจด้วย pandas

สร้าง histogram (2)

weather.WDIFF.plot(kind='hist', bins=20)
plt.show()

Histogram ของความแตกต่างด้านความเร็วลมที่มี bin มากขึ้น

การวิเคราะห์กิจกรรมตำรวจด้วย pandas

มาฝึกกันเถอะ!

การวิเคราะห์กิจกรรมตำรวจด้วย pandas

Preparing Video For Download...