開始使用免費開始

刪除遺漏資料

你已經探索過 volunteer 資料集並了解其結構與內容,現在該開始刪除遺漏值了。

在這個練習中,你會同時刪除欄與列,建立 volunteer 資料集的一個子集。

本練習屬於課程

Python 的 Machine Learning 前處理

檢視課程

練習說明

  • volunteer 中刪除 LatitudeLongitude 欄,並將結果儲存為 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(____.____)
編輯並執行程式碼