Class 9 · Unit 2: Data literacy · Lesson 2.3 · 40 min
Acquiring and preparing data
Row 14: a box of Delicious sold for ₹9,000. That's ₹900 a kilo. Apples aren't saffron.
Today you will: Hunt impossible values, mixed units and bad labels · Keep a change log · Know when to leave data out
Story
Rahat's group is predicting apple prices. They found a price list from the Sopore mandi and opened it expecting to start work.
Row 14 says a box of Delicious sold for ₹9,000.
Rahat: “That's the good news. Prices are up.”
Hiba does the arithmetic out loud. A box holds about ten kilograms. Nine thousand rupees for ten kilograms is nine hundred rupees a kilogram. Apples are not saffron.
Hiba: “That number isn't a price. It's a mistake. And if we don't find the rest of them, our whole prediction is built on it.”
She is right — but how do you find a wrong number in a file of four hundred rows?
Watch
Before you analyse, prepare — — scan code 9.2.3 in the printed book.
Learn it
Before any analysis, data has to be acquired and prepared, and the worst mistakes hide in plain sight. ₹9,000 for a box of apples is ₹900 a kilogram: that is not a price, it is a mistake, and a prediction built on it is wrong before it starts. Pre-processing hunts three new kinds of fault, and a change log records every decision, so anyone (including you, next month) can check it.
Words to know
- Data acquisition getting data. Four ways: measure it yourself, ask people (a survey), observe and record, or use existing records.
- Pre-processing everything you do to data before analysing it.
- Impossible value a number that cannot be true, like ₹900 a kilo for apples. Check numbers against what you already know.
- Mixed units some rows per kilogram, others per box. The column still adds up, and the answer means nothing.
- Inconsistent labels
Delicious,deliciousandDiliciousare one variety to a person and three to a machine. - Change log a table of every change: row · what was wrong · what we did · why.
Step by step: cleaning five rows of a walnut price list
| Row | Variety | Price | Unit |
|---|---|---|---|
| 1 | Kagzi | 700 | kg |
| 2 | kagzi | 7000 | kg |
| 3 | Burzul | 5500 | box |
| 4 | Burzul | 550 | kg |
| 5 | Wonth | 400 | (blank) |
- Save a copy first. Never clean the only copy.
- Impossible value: row 2, ₹7,000 a kilo, is ten times row 1. Probably a typing slip; we can't know, so mark it and leave it out.
- Mixed units: row 3 is per box (10 kg). Convert: 5,500 ÷ 10 = ₹550 a kilo, matching row 4.
- Inconsistent labels: change
kagzitoKagzi. - Missing unit: row 5 could be per kilo or per box. Mark it unknown and leave it out. Never guess.
- Log every change, and count: 5 rows at the start, 2 changed, 2 left out, 3 you trust.
Acquire well: name the source, get permission when the data is about people, record when and how it was collected, and don't collect only the easy cases.
🕌 From our heritage
Ibn Khaldūn (1332–1406) opened his Muqaddimah by attacking historians who repeated impossible numbers. One chronicle gave an ancient army as six hundred thousand men; he answered that a far larger empire could barely field a fraction of that, and that a state that size would have left traces nobody can find. His rule was that in reports of money and troop numbers, "exaggeration is to be expected", so a figure must be tested against what we know of the world and against the rules of probability. That is precisely the test Hiba ran on ₹9,000 a box.
Source: Ibn Khaldūn, al-Muqaddimah (1377), on the criticism of historical reports.
Careful: an impossible value is not the same as an outlier. An outlier is real but unusual, and you keep it; ₹9,000 for a box cannot be what the column says. And never work out a missing unit from the size of the number: that is guessing dressed up as reasoning.
On the laptop
You need: LibreOffice Calc · mandi-prices-messy.ods · change-log.ods
Mission 1: Copy first (1 min)
- ☐1
Open
mandi-prices-messy.odsand immediately save a copy with your roll numbers. Never clean the only copy.
Mission 2: Hunt three kinds of fault (13 min, in pairs)
- ☐2
Predict: how many rows will you have to change or remove? Write a number.
- ☐3
Impossible values: sort by
Price, descending. For each suspect, ask what is that per kilogram? - ☐4
Mixed units: use the
Unitcolumn. Convert per-kg rows to per-box at 10 kg a box. If a row has no unit, mark itunknownand leave it out — don't guess. - ☐5
Inconsistent labels: Data → AutoFilter on
Variety. Choose one spelling for each and fix the rest. - ☐6
Log every change in
change-log.ods: Row · What was wrong · What we did · Why.
Mission 3: Count and ask (4 min)
- ☐7
Write: rows at the start · changed · removed · rows you trust. Then the one question you'd ask the mandi clerk.
Finished early?
Find a price that is possible but suspicious. What would it take to trust it?
No laptop today?
Mark the twelve-row printed table with I (impossible), U (unit), L (label), then rewrite it cleanly with a four-column change log beside it.
Debate it
Your pair removed nine rows, including four where the unit was missing. A classmate says: "Now your data is smaller, so your answer is worse."
Is a smaller, trustworthy dataset worse than a bigger one with mistakes in it? When would each answer be right?
Check yourself — practice, not a test
1. Put these pre-processing steps in a sensible order:
- 1. Fix mixed units and inconsistent labels
- 2. Find impossible values and check them against what you know
- 3. Record every change in the change log
- 4. Save a copy of the original
2. A row gives a price but no unit. The honest thing is to:
- ○ Assume it is per box, like most rows
- ○ Assume it is per kilogram, to be safe
- ○ Mark it unknown and leave it out of the analysis
- ○ Delete it silently
3. Delicious and delicious count as the same variety when a machine groups the rows.
- ○ True
- ○ False
4. Which are ways of acquiring data? (choose all that apply)
- ○ Measuring it yourself
- ○ Asking people in a survey
- ○ Observing and recording
- ○ Using records someone already keeps
- ○ Estimating what it probably was
5. A ______ log records what was wrong, what you did and why — so that somebody else can check your cleaning.
Remember
Cleaning is not tidying. Every change gets a reason, and a line in the log.
Typing practice
Skill: brackets and quotes, in pairs (Term 1 focus, 5 min)
-
On typing.com, continue the symbols lessons.
-
Then type each of these five times. Every one is a formula you will use today:
=COUNTIF(C2:C40;"Delicious") -
Brackets and quotation marks always come in pairs. Train the pair as one movement: open, type, close. Depending on the laptop's language setting the separator is
;or,.