Skip to content

Practice Fill Missing Data

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2887
LeetCode Problem

Fill Missing Data

Problem Statement

The products DataFrame has name (object), quantity (int) and price (int) columns. Replace missing values in quantity with 0 and return the resulting DataFrame.

Source: Fill Missing Data on LeetCode. Use the original task for its coding environment and submissions.

Examples

# 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  | +-----------------+----------+-------+

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.