跳到正文

第 5 课 · Profiling Data

Data Quality Dimensions

Understand data quality dimensions such as completeness, validity, uniqueness, consistency, accuracy and timeliness, and measure them with a scorecard.

"The data is bad" is hard to act on. Quality dimensions split that complaint into specific questions you can measure and assign to someone. Different frameworks use different lists and names. The six below are widely used and cover most practical cases.

Six dimensions

Is it there and single?

Completeness Are values present?
Uniqueness One record per thing?
1 / 3

Valid is not the same as accurate

A birth date of 1990-05-01 is valid: it is a real date in the right format. It may still be inaccurate, because the person was born in 1991. Code can check validity from the data and the rules alone. Accuracy usually needs an outside reference, such as a source document, a trusted register or a confirmation from the person.

So a dataset can pass every automatic rule and still be wrong. Say "valid" when you mean valid.

Turn dimensions into measures

A useful measure is often a share of records that pass a clear rule. State the rule, the columns and which records you counted. "Email completeness: 92% of active customers have a non-empty email" means something. "Quality: good" does not.

Python A small data quality scorecard

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The email pattern is deliberately loose. It checks the rough shape only. Whether a mailbox exists is a question that no pattern can answer.

Note the denominator for format validity: only filled emails. If you counted empty ones as invalid too, you would count the same problem twice and hide which one you have.

Consistency

Consistency compares things that should agree:

  • Within a row: the line total equals quantity times price.
  • Across rows: one product code always has one product name.
  • Across systems: the sales total in the report matches the billing system.
Python Find codes with more than one name

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The check finds the conflict but cannot say which name is right. That decision belongs to whoever owns the product list.

Set targets that fit the use

Not every column needs to be perfect. Agree on thresholds with the people who use the data:

Measure Target (example) If it fails
Order ID uniqueness 100% Stop the load
Shipping postal code present At least 99% Alert the team
Marketing preference present At least 80% Note it in the report

These targets are invented examples. Yours should come from what goes wrong if the rule fails.

Watch quality over time

A single score is a snapshot. Save scores with each load. A sudden drop may point to a changed form, a new data source or a broken export. Also break scores down by source or region: an overall 95% can hide one office at 60%.

Common mistake: combining all dimensions into one average score. A perfect completeness score can cancel out a serious uniqueness failure. Report the important measures separately.

Ownership

Measures help only when someone acts on them. For each important rule, name who gets the alert, who decides the fix and how fast it matters. Broader ownership practices are part of data management.

A worked discussion

Imagine a delivery team that complains about "bad addresses". Dimensions help you ask better questions. Are addresses missing for some orders? That is completeness. Do postal codes break the format for their country? That is validity. Does the city disagree with the postal code? That is consistency. Did the customer move last year while the record stayed the same? That is accuracy, and also timeliness.

Each answer points to a different fix. A required field helps with completeness. A format check at data entry helps with validity. Neither one tells you that a customer has moved. For that you might ask customers to confirm their address before shipping.

Measure what you can, sample what you cannot

Automatic rules can score every record. Accuracy often cannot be scored that way, so teams check a sample against a trusted source. Choose the sample at random, record how you chose it and say how large it was. A result from a small sample is an estimate with real uncertainty, so do not report it as an exact fact about every record. If you pick only the records that look suspicious, you learn about those records, not about the whole table.

From score to action

For each measure, write down four things:

  1. The rule, in one sentence a colleague can repeat.
  2. The records it applies to.
  3. The threshold that triggers action.
  4. The person or team who acts, and what they do.

If you cannot fill in the last line, ask whether the measure is worth collecting. A short list of rules that people respond to is more valuable than a long dashboard that nobody reads.

Be careful with comparisons

Two teams can both report "98% complete" and mean different things if one counts only active customers. Before you compare scores, confirm that the rules and populations match.

Start small

Pick three to five rules linked to real problems that someone has felt, such as returned parcels or repeated invoices. Measure them for a few deliveries before you add more. A starting measurement also lets you show later whether a change in a form or process actually helped.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. A phone number has the correct format but belongs to someone else. Which dimension fails?

    It follows the format rule but does not match reality.
  2. 2. Which is the most useful quality statement?

    It names the rule, the column and the population, so others can reproduce and act on it.
  3. 3. One product code has two names in different rows. Which dimension is this?

    Values that should agree across rows do not.

Summary

  • Dimensions turn vague complaints into measurable rules.
  • Valid data can still be inaccurate.
  • State each rule with its denominator.
  • Set targets by the cost of failure and track them over time.

Next: Finding Missing Values

你的学习进度保存在此浏览器中,无需账号。