刪除遺漏資料
你已經探索過 volunteer 資料集並了解其結構與內容,現在該開始刪除遺漏值了。
在這個練習中,你會同時刪除欄與列,建立 volunteer 資料集的一個子集。
本練習屬於課程
Python 的 Machine Learning 前處理
練習說明
- 從
volunteer中刪除Latitude與Longitude欄,並將結果儲存為volunteer_cols。 - 以刪除
category_desc中含有遺漏值的列來篩選volunteer_cols,將結果儲存到新變數volunteer_subset。 - 檢視
volunteer_subset的.shape屬性,以確認是否正確執行。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Drop the Latitude and Longitude columns from volunteer
volunteer_cols = ____
# Drop rows with missing category_desc values from volunteer_cols
volunteer_subset = ____
# Print out the shape of the subset
print(____.____)