Ciaren

Remove duplicates

Remove duplicates — removeDuplicates

Drop duplicate rows.

Use cases

  • Collapse exact duplicate records.
  • Keep one row per key (e.g. one row per customer_id) by choosing a subset.

What it does

With subset: ["email"], any two rows sharing the same email are considered duplicates and only the first is kept.

Before
emailnamescore
[email protected]Grace H92
[email protected]Ada L88
[email protected]Grace Hop95
[email protected]Linus T74
4 rows · 3 cols
Remove duplicates (subset=email, keep=first)
After
emailnamescore
[email protected]Grace H92
[email protected]Ada L88
[email protected]Linus T74
3 rows · 3 cols

Configuration

Config keyTypeRequiredDescription
subsetstring[]NoOnly consider these columns when deciding duplicates
keepstring | falseNofirst (default), last, or false (drop all duplicates)

Generated Python code

df_2 = df_1.drop_duplicates()

Tips & common mistakes

  • subset controls "duplicate by what". Without it, two rows must match on every column to count as duplicates.
  • keep: false drops every copy of a duplicated row — use it to find rows that are truly unique.
  • Pair with Sort rows first when keep: first/last should pick a specific record per key.

See also