開始使用免費開始

選取失蹤的小狗

回到我們裝載在 mpr 的失蹤小狗 DataFrame。來選取幾筆不同的列,進一步了解其他失蹤的狗狗。

本練習屬於課程

Python 的資料科學入門

檢視課程

練習說明

  • 選取 Age 大於 2 的狗。
  • 選取 Status 等於 Still Missing 的狗。
  • 選取所有 Dog Breed 不等於 Poodle 的狗。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Select the dogs where Age is greater than 2
greater_than_2 = mpr[mpr.Age ____ 2]
print(greater_than_2)

# Select the dogs whose Status is equal to Still Missing
still_missing = mpr[____ ____ ____]
print(still_missing)

# Select all dogs whose Dog Breed is not equal to Poodle
not_poodle = ____
print(not_poodle)
編輯並執行程式碼