Data Science Foundations · Beginner

Data Cleaning Lab

Trace raw rows through diagnosis, imputation, duplicate handling, IQR outlier evidence, scaling, and categorical encoding.

A small table-first data-quality studio. Every transformation is explicit: missing cells are detected, replacement statistics are calculated, exact duplicate records are identified, outliers are flagged or capped with the 1.5×IQR rule, numeric features are z-scored, and city categories become one-hot features.

Step by step

  1. Inspect the untouched table first, then diagnose missing cells and exact duplicate feature rows without mutating the source.
  2. Choose mean or median numeric imputation and use the modal category for missing categorical values.
  3. Remove exact duplicate records without treating the row identifier as a model feature.
  4. Calculate Q1, Q3, IQR, and the 1.5×IQR fences; flag outliers before deciding whether to cap them.
  5. Standardize numeric columns with z = (x−μ)/σ.
  6. One-hot encode the categorical city field so categories do not receive a fake numeric ordering.

Core formulas

IQR fences

[Q1 − 1.5·IQR, Q3 + 1.5·IQR]

A common descriptive rule for flagging unusually distant values.

Z-score

z = (x − μ) / σ

Center a numerical feature at zero and express distance in standard deviations.

One-hot encoding

category → [0,…,1,…,0]

Represent an unordered category with separate binary indicator features.

When to use Data Cleaning Lab

  • Learning why data quality decisions should be visible before model training.
  • Understanding missing-value, duplicate, outlier, scaling, and categorical encoding mechanics.
  • Practicing transformation auditability before moving to feature engineering.

Primary references

Google ML Crash Course — Numerical data conclusion

scikit-learn — OneHotEncoder