分析 Energy counter 資料
直接把 energy counter 的資料畫成圖,只會看到兩條直線。
energy counter 提供的是累積總量,但你真正關心的是每次量測之間消耗了多少能源。
你需要計算相鄰兩筆數值的差,才能看出每個區間消耗了多少能源。 從差值計算百分比變化,可以更容易比較,也能帶來新的洞見。
已經將 pandas 以 pd 匯入,matplotlib.pyplot 以 plt 匯入。DataFrame 以 df 提供。
本練習屬於課程
使用 Python 分析 IoT 資料
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Get difference between values
____
# Plot the DataFrame
df_diff.plot()
plt.show()