Skip to content
CampusEduX

Problem 2: Drop Rows with Missing Values

Easypython
Learn the Concept: Handling Missing Values

Problem Description

Write a Python program that removes all rows containing any missing values from a DataFrame, and prints the shape before and after.

Input

A DataFrame with some missing values.

Output

The DataFrame's shape before and after dropping rows with missing values.

Constraints

  • None specific.

Example Input

text
{"age": [25, None, 30, 22], "city": ["Delhi", "Mumbai", None, "Pune"]}

Example Output

text
Before: (4, 2) After: (2, 2)

Concepts Covered

dropna(), shape.

Related Problems

  • Problem 1: Detect and Count Missing Values
    Easy · python
    Solve Problem
  • Problem 3: Fill Missing Numeric Values with Median
    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...