Menu

Outliers and Validation Rules

Lesson 4: Outliers and Validation Rules

What is an outlier?

An outlier is a value that differs markedly from most observations. It may be:

Type

Example

Typical action

ErrorAge = 250Correct from source or set to missing
Rare but valid eventA ₹5 lakh corporate orderKeep; perhaps analyse separately
Different processBulk B2B orders mixed with retailSegment the data
Important signalFraud, system outageInvestigate and escalate

Statistical rules flag candidates; context decides what to do.

Validation checks

Check type

Rule example

RangeQuantity > 0; discount between 0% and 100%
Allowed valuesRegion ∈ {North, South, East, West}
UniquenessOrder ID unique in the orders table
Not nullOrder date must be present
Date logicDelivery date ≥ order date; no far-future dates
Cross-fieldRevenue = quantity × unit price (within rounding)
Referential integrityEvery customer_id in orders exists in customers
FormatEmail contains "@"; PIN code has 6 digits
Business ruleReturns only for delivered orders

Example

A product price of 0 could be:

  • A data error
  • A free sample
  • A promotional item
  • A placeholder for an unpriced product

Compare it with product records and transaction context before changing it.

How it works

Separate detection from treatment:

  1. Detect: flag suspicious values with rules.
  2. Investigate: check the source and context.
  3. Treat: choose one of:
    • Correct it from a trusted source
    • Keep it, with an explanation
    • Exclude it from a specific calculation
    • Escalate it to the data owner
  4. Document: record the rule, the number of records affected, and the impact.

Common mistakes

  • Deleting every extreme value, which removes important incidents or high-value customers.
  • Not recording the rule used.
  • Not measuring the effect of the decision on the final result.
  • Fixing data silently without telling the data owner, so the source problem continues.

Try it: Create five validation rules for a sales dataset and explain what you would do when each rule fails.


Data Analytics Tutorial



Learn via Video Course

Data Analysis and Processing with Python using Pandas - Data Science Course Logo

Data Analysis and Processing with Python using Pandas - Data Science Course

5 hrs



Get in Touch For Details