Data Quality Problems

Context: FIT1043_MOC Β· the defects wrangling must fix Β· found by auditing Β· each has a detect β†’ fix strategy

Quick Revision

  • 🎯 Objective: recognise the common data-quality issues and pair each with a detection and a fix.
  • πŸ“¦ Core Components: interpretability Β· format Β· inconsistency/misspelling Β· irregularities Β· integrity violations Β· missing Β· outliers Β· duplicates.
  • ⚑ Key Constraint: fixing is judgement + justification β€” imputation vs removal, or keeping an outlier, depends on domain context, not a rule.

πŸ“ How It Works

1. The Issue Types (causes)

  • Interpretability βž” no documentation / data dictionary βž” can’t reliably use the fields; obtain the dictionary.
  • Data format βž” sources differ (JSON vs XML, etc.) βž” hard to integrate; convert to a common format.
  • Inconsistent / faulty βž” mistyped, inconsistent entry, extraneous data.
  • Missing / incomplete, Outliers, Duplicates βž” see detection/fixing below.

2. Detect & Fix (worked cases)

  • Inconsistency & misspelling βž” detect unique(), value_counts(); fix standardise case / representation (e.g. 0↔No), replace infrequent values with the best-matching frequent one.
  • Irregularities (invalid dates, domain-invalid like negative passengers) βž” detect unique(), value ranges, type-casting (parse to datetime, catch exceptions); fix consult docs, replace, or remove.
  • Integrity-constraint violations (land < building size; one field = sum of others) βž” detect domain rules; fix swap or remove.
  • Missing values βž” detect unique(), value range, domain analysis (may be coded, e.g. ? or *); fix imputation (mean/mode, regression via df.corr(), dummy value) or removal β€” justify the choice.
  • Outliers βž” detect df.describe() range, boxplot (IQR rule), 3Οƒ rule; fix as for missing values.
  • Duplicates βž” detect pick candidate keys (fix other issues first, try different keys); fix merge/combine or remove.

βš–οΈ Core Decision Matrix

ProblemDetect withFix with
Inconsistency/misspellingunique(), value_counts()standardise; replace infrequent β†’ best match
Irregularitiesranges; type-cast + catch errorsdocs / replace / remove
Integrity violationdomain rules (context)swap / remove
Missing valuesunique(), ranges, domain analysisimpute (mean/mode/regression/dummy) or remove
Outliersdescribe(), boxplot, 3Οƒimpute or remove (justify)
Duplicatescandidate keysmerge / remove

When It Flips: missing values and outliers share the same fix menu (impute vs remove) β€” the differentiator is detection, and every removal/imputation needs a domain justification.

πŸ“Š Exam Execution Trace

Applied Exercise

Problem: A price column has and . Which values are outliers by the IQR rule? Derivation Proof / Hand-Calculation Walkthrough:

Final Extracted Output: anything or is an outlier (so a \2{,}000{,}000$ listing flags).

🧠 Active Recall