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

分享至
成為作者繼續創作的動力吧!
© 2024 vocus All rights reserved.