How do you identify and handle inconsistent values such as typos, casing, whitespace and categorical label variants?

Quick Overview

Explain how you would detect and clean inconsistent text values in a dataset, such as typos, mixed capitalization, stray whitespace and different spellings of the same category. It tests practical data cleaning judgment for messy categorical columns.

How do you identify and handle inconsistent values such as typos, casing, whitespace and categorical label variants?

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

How do you identify and handle inconsistent values such as typos, inconsistent capitalization, extra whitespace, or variations in categorical labels? Assume a text column in a dataset you are about to analyze, such as a city name or a product category. ```hint Look before you fix Start from the distinct values and how often each one appears, then ask which fixes are safe to apply automatically and which need someone to confirm them. ``` ### What a Strong Answer Covers - How to find the variants before changing anything (distinct values with counts, sorted or grouped so near-duplicates sit together). - Deterministic normalization for whitespace, case, punctuation and encoding. - Mapping variants to one canonical label, and catching typos with fuzzy matching that a person reviews. - The risk of over-merging values that look alike but mean different things. - How to keep the problem from coming back and keep the cleaning reproducible (controlled vocabulary, validation, a versioned mapping table, the raw column kept). ### Follow-up Questions - How would you choose the similarity threshold for fuzzy matching, and how would you check that it is right? - Pairwise fuzzy matching is quadratic. How would you handle a column with millions of distinct company names? - A new variant shows up after the mapping table is in production. How does your pipeline notice it and deal with it? - When would you deliberately keep two similar-looking values separate?

Overview: Explain how you would detect and clean inconsistent text values in a dataset, such as typos, mixed capitalization, stray whitespace and different spellings of the same category. It tests practical data cleaning judgment for messy categorical columns.

PracHub logo
General
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

How do you identify and handle inconsistent values such as typos, inconsistent capitalization, extra whitespace, or variations in categorical labels? Assume a text column in a dataset you are about to analyze, such as a city name or a product category.

What a Strong Answer Covers Guidance

  • How to find the variants before changing anything (distinct values with counts, sorted or grouped so near-duplicates sit together).
  • Deterministic normalization for whitespace, case, punctuation and encoding.
  • Mapping variants to one canonical label, and catching typos with fuzzy matching that a person reviews.
  • The risk of over-merging values that look alike but mean different things.
  • How to keep the problem from coming back and keep the cleaning reproducible (controlled vocabulary, validation, a versioned mapping table, the raw column kept).

Follow-up Questions Guidance

  • How would you choose the similarity threshold for fuzzy matching, and how would you check that it is right?
  • Pairwise fuzzy matching is quadratic. How would you handle a column with millions of distinct company names?
  • A new variant shows up after the mapping table is in production. How does your pipeline notice it and deal with it?
  • When would you deliberately keep two similar-looking values separate?