Understanding Data Quality
Why data quality matters
Section titled “Why data quality matters”Bad data quality leads to:
- Wrong decisions
- Broken dashboards
- Unreliable ML models
- Loss of trust
Data preprocessing is the discipline of making data usable and trustworthy.
Key dimensions of data quality
Section titled “Key dimensions of data quality”1) Completeness
Section titled “1) Completeness”Are required values missing?
df.isna().sum()- Missing percentage per column
2) Accuracy
Section titled “2) Accuracy”Do values match reality?
- Negative ages
- Impossible dates (future DOB)
- Wrong units (₹ vs paise)
3) Consistency
Section titled “3) Consistency”Do values follow the same format across rows?
- “delhi”, “Delhi”, ” DELHI ”
- Mixed currencies
4) Validity
Section titled “4) Validity”Do values fit the allowed set/range?
statusshould be one of: closedratingmust be 1–5
5) Uniqueness
Section titled “5) Uniqueness”Are there duplicates?
- Duplicate rows
- Duplicate IDs
Practical quality checks (Pandas)
Section titled “Practical quality checks (Pandas)”# shape
print(df.shape)
# schema
print(df.dtypes)
# missing
print(df.isna().sum().sort_values(ascending=False).head(20))
# duplicates
print("Duplicate rows:", df.duplicated().sum())
# basic stats
print(df.describe(include="all"))Typical preprocessing outputs
Section titled “Typical preprocessing outputs”- Cleaned columns (trimmed text, fixed casing)
- Correct dtypes (numeric/date)
- Handled missing values
- Outlier strategy selected (remove/cap/keep)
- Encoded categories for modeling
Rule of thumb
Section titled “Rule of thumb”Always document:
- What you changed
- Why you changed it
- What assumptions you made
Visualize it
Section titled “Visualize it”Think of data quality as a pipeline of checks. Raw data only becomes “trustworthy” once it has passed through each dimension below.
flowchart LR A["Raw data"] --> B["Completeness check"] B --> C["Accuracy check"] C --> D["Consistency check"] D --> E["Validity & uniqueness check"] E --> F["Trustworthy dataset"]
🧪 Try It Yourself
Section titled “🧪 Try It Yourself”Exercise 1 – Count missing values
Section titled “Exercise 1 – Count missing values”Exercise 2 – Find duplicate rows
Section titled “Exercise 2 – Find duplicate rows”Exercise 3 – Check validity of a range
Section titled “Exercise 3 – Check validity of a range”Once you know where the quality problems are, the next step is usually fixing dtypes — head to Outlier Detection (IQR Method) to start finding the extreme values hiding in your numbers.
pch.coffeeTagline
pch.coffeeCtapch.feedbackHeading
pch.feedbackSubheading