繪製溫度差
在這個練習中,你會透過繪製最高溫與最低溫之差,繼續評估這個資料集是否值得信任。
你對產生的直方圖有什麼觀察?它是否符合你的預期,還是出現了什麼不尋常的情況?
本練習屬於課程
使用 pandas 分析警方執法活動
練習說明
- 在
weatherDataFrame 中建立名為TDIFF的新欄位,表示最高溫與最低溫的差值。 - 使用
.describe()方法列印TDIFF的摘要統計。 - 建立一個具有 20 個區間的直方圖以視覺化
TDIFF。 - 顯示圖表。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create a 'TDIFF' column that represents temperature difference
# Describe the 'TDIFF' column
print(____)
# Create a histogram with 20 bins to visualize 'TDIFF'
# Display the plot