Skip to content
C

Problem 3: Remove Duplicates Based on a Specific Column

Easypython

Problem Description

Write a Python program that removes duplicate rows based only on a "customer_id" column, even if other columns differ slightly, keeping the first occurrence.

Input

A DataFrame with a "customer_id" column containing some repeated values.

Output

The DataFrame after removing rows with duplicate customer IDs.

Constraints

  • None specific.

Example Input

text
{"customer_id": [101, 102, 101], "name": ["Aarav", "Meera", "Aarav K."]}

Example Output

text
customer_id name 0 101 Aarav 1 102 Meera

Concepts Covered

drop_duplicates(subset=[...]).

Input (stdin)

Output

Run your code to see output here...