सामग्री पर जाएँ

Data Cleaning ट्यूटोरियल

Data cleaning tutorial: profiling, missing values, duplicates, types, text and date fixes, outliers, validation rules, repeatable pipelines and projects.

Getting Started

  1. 1 What Is Data Cleaning? Learn what data cleaning is, why messy data leads to wrong answers, what you need before you start, and how this tutorial takes you from profiling to projects.
  2. 2 A Safe Data Cleaning Workflow Follow a safe data cleaning workflow: keep raw data untouched, make changes in code, log every rule, count rows before and after, and verify the result.
  3. 3 Reading Messy Files Read messy CSV files safely: handle text encodings, byte order marks, delimiters, quoted fields, title rows, footers and wide layouts before you clean values.

Profiling Data

  1. 4 Profiling a Dataset Profile a new dataset before cleaning: row counts, missing and unique values, ranges, frequent values, text patterns and cross-column checks in Python.
  2. 5 Data Quality Dimensions Understand data quality dimensions such as completeness, validity, uniqueness, consistency, accuracy and timeliness, and measure them with a scorecard.

Missing Values

  1. 6 Finding Missing Values Find missing values, including hidden ones like N/A, -999, blank spaces and default dates, and see how Python, pandas and averages treat missing data.
  2. 7 Why Data Is Missing: MCAR, MAR and MNAR Learn the three missing data mechanisms, MCAR, MAR and MNAR, with simple simulations that show when dropping rows biases results and what you can check.
  3. 8 Filling or Dropping Missing Values Decide whether to keep, drop or fill missing values. Compare mean, median, group and forward fill imputation, add flags and avoid leaking information.

Duplicates and Identifiers

  1. 9 Removing Exact Duplicates Find duplicate rows safely: define what makes a record unique, normalize values first, choose which copy to keep and never drop genuine repeat events.
  2. 10 Fuzzy Matching and Record Linkage Match near-duplicate records with normalization, string similarity, blocking and scoring thresholds, and send uncertain pairs to human review in Python.
  3. 11 Keys and Identifiers Clean identifiers and keys: keep them as text, fix padding carefully, validate check digits, find orphan records and avoid joins that silently multiply rows.

Types, Text and Dates

  1. 12 Converting Data Types Safely Convert messy text into numbers, money, percentages and booleans with explicit rules, handle locale formats and report every value that fails to convert.
  2. 13 Cleaning Text with Python and Regex Clean text data in Python: fix invisible spaces, normalize Unicode and letter case, and use regular expressions to extract and validate structured values.
  3. 14 Standardizing Categories Standardize messy category values with mapping tables, review unknown values, suggest matches safely, handle rare categories and keep allowed lists current.
  4. 15 Cleaning Dates and Times Clean messy dates: parse known formats, resolve day-month ambiguity, convert spreadsheet serial numbers and handle time zones and daylight saving safely.

Outliers and Impossible Values

  1. 16 Detecting and Handling Outliers Detect outliers with the IQR rule and robust z-scores, investigate before acting, and choose to keep, correct, cap, transform or exclude unusual values.
  2. 17 Impossible Values and Unit Errors Catch impossible values with range and cross-field rules, spot mixed units and scale errors, convert them with evidence and keep an audit trail of fixes.

Validation and Pipelines

  1. 18 Writing Validation Rules Write reusable data validation rules for schemas, columns, rows and datasets, set severity levels, collect all failures and stop bad data from loading.
  2. 19 Building a Repeatable Cleaning Pipeline Turn cleaning code into a repeatable pipeline with small pure functions, configuration, step reports, idempotent output and safe handling of rejected rows.
  3. 20 Testing and Documenting Cleaning Work Test cleaning rules with examples and edge cases, then record decisions in a data dictionary, a change log and a run report others can review and trust.

Cleaning in SQL and Spreadsheets

  1. 21 Cleaning Data with SQL Clean data in SQL with TRIM, LOWER, NULLIF, CASE, safe type conversion and mapping tables, while keeping raw tables unchanged behind staging views.
  2. 22 Deduplicating and Validating in SQL Remove duplicates in SQL with ROW_NUMBER, write validation queries that return only failures, and block new bad rows with CHECK, UNIQUE and key constraints.
  3. 23 Cleaning Data in Spreadsheets Clean spreadsheet data safely: protect raw sheets, import with explicit types, use text and lookup formulas, remove duplicates and record steps in Power Query.

Projects and Reference

  1. 24 Project: Clean a Customer List Build a complete customer list cleaner in Python: profile messy contacts, standardize emails and countries, parse dates, merge duplicates and report results.
  2. 25 Project: Repair a Sales Export in SQL Practice SQL data cleaning on a messy sales export: stage raw text, validate and convert values, map regions, remove reloads, quarantine failures and reconcile.
  3. 26 Data Cleaning Glossary and Cheat Sheet A data cleaning glossary and cheat sheet with key terms, a step-by-step checklist and quick Python, pandas, SQL and spreadsheet snippets for common fixes.