2024-01-09|閱讀時間 ‧ 約 0 分鐘

Drop Missing Data 捨棄帶有缺失值的data row_Intro to Pandas

題目敘述

題目會給定一個pandas DataFrame作為輸入,要求我們以原有的資料表name欄位為檢查基準,刪除有缺失值None的 data rows。

題目的原文敘述


測試範例

Example 1:

Input:
+------------+---------+-----+
| student_id | name | age |
+------------+---------+-----+
| 32 | Piper | 5 |
| 217 | None | 19 |
| 779 | Georgia | 20 |
| 849 | Willow | 14 |
+------------+---------+-----+
Output:
+------------+---------+-----+
| student_id | name | age |
+------------+---------+-----+
| 32 | Piper | 5 |
| 779 | Georgia | 20 |
| 849 | Willow | 14 |
+------------+---------+-----+
Explanation:
Student with id 217 havs empty value in the name column, so it will be removed.

這筆資料在name欄位有缺失值​,所以最後從資料表中刪除掉。
| 217 | None | 19 |
付費訂閱
分享至
成為作者繼續創作的動力吧!
Leetcode Introduction to Pandas 入門題解,含python解題程式碼、中文講解,和學習資源連結。 在可能的情況下,提供多種解答,培養觸類旁通,舉一反三的能力。 Leetcode Introduction to Pandas 題目預覽 http://tinyurl.com/2a476tpz
© 2024 vocus All rights reserved.