Skip to content
C

Problem 2: Drop Rows with Missing Values

Easypython

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.

Input (stdin)

Output

Run your code to see output here...