繪製手機資料圖表
我們已經知道是 Freddy Frequentist 綁架了黃金獵犬 Bayes。接下來要找出他藏身的位置。
警局的朋友取得了手機定位資料,裡面包含 Freddie 過去 3 週的一些位置。這些資料儲存在 cellphone 這個 DataFrame 中。x 座標在欄位 'x',y 座標在欄位 'y'。
matplotlib 模組已經以別名 plt 匯入。
本練習屬於課程
Python 的資料科學入門
練習說明
- 顯示 DataFrame 的前 5 列,並判斷要繪製哪些欄位。
- 使用
cellphone的資料建立一張散佈圖。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Explore the data
print(cellphone.____)
# Create a scatter plot of the data from the DataFrame cellphone
plt.____(____, ____)
# Add labels
plt.ylabel('Latitude')
plt.xlabel('Longitude')
# Display the plot
plt.show()