Skip to content
CampusEduX

Problem 3: Fill Missing Numeric Values with Median

Easypython
Learn the Concept: Handling Missing Values

Problem Description

Write a Python program that fills missing values in a numeric column with the column's median value.

Input

A DataFrame with a numeric column containing missing values.

Output

The column after filling missing values with the median.

Constraints

  • The column will contain at least one non-missing value.

Example Input

text
{"score": [50, None, 70, 90, None]}

Example Output

text
[50, 70, 70, 90, 70]

Concepts Covered

fillna(), median().

Related Problems

  • Problem 1: Detect and Count Missing Values
    Easy · python
    Solve Problem
  • Problem 2: Drop Rows with Missing Values
    Easy · python
    Solve Problem
  • Problem 4: Use SimpleImputer for Mixed Column Types
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...