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

Fill Missing Data 填補指定欄位的缺失值_Intro to Pandas

題目敘述

題目會給定一個pandas DataFrame作為輸入,要求我們在原有的資料表上,將所有在欄位quantity的缺失值填補為0。


題目的原文敘述


測試範例

Example 1:
Input:+-----------------+----------+-------+
| name | quantity | price |
+-----------------+----------+-------+
| Wristwatch | None | 135 |
| WirelessEarbuds | None | 821 |
| GolfClubs | 779 | 9319 |
| Printer | 849 | 3051 |
+-----------------+----------+-------+
Output:
+-----------------+----------+-------+
| name | quantity | price |
+-----------------+----------+-------+
| Wristwatch | 0 | 135 |
| WirelessEarbuds | 0 | 821 |
| GolfClubs | 779 | 9319 |
| Printer | 849 | 3051 |
+-----------------+----------+-------+
Explanation:
The quantity for Wristwatch and WirelessEarbuds are filled by 0.

所有在quantity欄位有空缺的地方,都補上0

付費訂閱
分享至
成為作者繼續創作的動力吧!
Leetcode Introduction to Pandas 入門題解,含python解題程式碼、中文講解,和學習資源連結。 在可能的情況下,提供多種解答,培養觸類旁通,舉一反三的能力。 Leetcode Introduction to Pandas 題目預覽 http://tinyurl.com/2a476tpz
從 Google News 追蹤更多 vocus 的最新精選內容從 Google News 追蹤更多 vocus 的最新精選內容

發表回應

成為會員 後即可發表留言
© 2024 vocus All rights reserved.