Pandas → T-SQL › drop_duplicates
Pandas drop_duplicates to DISTINCT / ROW_NUMBER
DISTINCT collapses to the columns you list. If you need the rest of the row, number it.
SELECT *
FROM (
SELECT c.*, ROW_NUMBER() OVER (PARTITION BY email ORDER BY customer_id) AS rn
FROM Customers c
) x
WHERE rn = 1;
keep=False (drop every duplicate) is a HAVING COUNT(*) = 1 join.
Canonical translation
SELECT *
FROM (
SELECT c.*, ROW_NUMBER() OVER (PARTITION BY email ORDER BY customer_id) AS rn
FROM Customers c
) x
WHERE rn = 1;
Then write it on a ticket
Monday is free. A colleague asks, you type, we mark it.
Clock in free