Skip to content
CampusEduX

Problem 2: Remove Full-Row Duplicates

Easypython
Learn the Concept: Removing Duplicates

Problem Description

Write a Python program that removes all duplicate rows from a DataFrame, keeping only the first occurrence, and prints the shape before and after.

Input

A DataFrame containing duplicate rows.

Output

The DataFrame's shape before and after removing duplicates.

Constraints

  • None specific.

Example Input

text
{"id": [1, 2, 3, 1, 2], "value": ["A", "B", "C", "A", "B"]}

Example Output

text
Before: (5, 2) After: (3, 2)

Concepts Covered

drop_duplicates(), shape.

Related Problems

  • Problem 1: Detect Duplicate Rows
    Easy · python
    Solve Problem
  • Problem 3: Remove Duplicates Based on a Specific Column
    Easy · python
    Solve Problem
  • Problem 4: Keep Last Occurrence Instead of First
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...