Collapse Duplicate Product Listings Within a Brand by Normalized Title

Last updated: November 29, 2026

Quick Overview

Sellers sometimes create multiple ASINs for the same product. Given a pandas DataFrame of listings (asin, brand, title, created_at), normalize brand and title, group listings that are the same product within the same brand, and map every ASIN to the oldest ASIN in its group as the canonical listing.

Amazon
Data Manipulation (SQL/Python)
Data Scientist
Amazon
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Sellers sometimes create multiple ASINs for the same product. Given a pandas DataFrame of listings (asin, brand, title, created_at), normalize brand and title, group listings that are the same product within the same brand, and map every ASIN to the oldest ASIN in its group as the canonical listing.

Catalog quality teams at Amazon merge duplicate detail pages so customers see one listing with all offers and reviews. In a technical screen this tests pragmatic text normalization, choosing a deterministic canonical record, and groupby transform, plus judgment about where exact-key matching stops being enough.

What the Interviewer Expects
  • Normalize brand (trim, case) and title (case, punctuation, noise words) into a match key
  • Make the key order-insensitive so reordered titles match
  • Choose the canonical record deterministically (oldest, then ASIN as tie-break)
  • Use groupby transform to broadcast the canonical ASIN to every row
  • Discuss false merges such as different wattages and how the key protects them
Key Topics to Cover
deduplication
text normalization
groupby transform
entity resolution
canonical records
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you catch near-duplicates such as typos that an exact key misses?
  • Why is grouping within brand important, and when could it miss real duplicates?
  • How would you validate precision of the merges before applying them to the live catalog?
  • How would you scale this to hundreds of millions of listings?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data
  • listings(asin, brand, title, created_at). Brands vary in case and whitespace; titles vary in punctuation, word order and marketing noise like "NEW".
  • Two listings are the same product if, within ...
Approach
  1. Brand key: strip and lower-case.
  2. Title key: lower-case, replace punctuation with spaces (so USB-C and USB C both become usb c), drop a small noise vocabulary, sort tokens and join. Sorting...

Submit Your Answer
Markdown supported