What is big data? The 5 Vs explained

Big data is not just “a very big file”. In this lesson you follow a ₹20 chai payment and see the five things that make data “big”: how much there is, how fast it arrives, how mixed it is, how trustworthy it is, and what it is worth. Then you measure all five on real data with Python, watch them light up during a midnight sale, and go deeper into peaks, value decay and the cost of keeping data.

Module 1 · Introduction⏱ 28 minBeginner → AdvancedRuns in your browser (Python)3 real-time scenariosRun on your PC10 practice problems
1 The story

The canteen file that Excel could not open

The college canteen switched to QR payments last year, and its billing app keeps a record of every order. The owner asks Riya to “just open the file in Excel and tell me what sells most”. The file is called orders.csv. Excel opens it, thinks for a while, and shows: File not loaded completely.

Pay ₹20 ✓ success orders.csv T1001,chai,20,UPI,08:01 T1002,vada pav,25,UPI,08:01 T1003,chai,20,cash,08:02 … one row per order After one year 13,50,000 rows (orders) ≈ 3,700 orders a day × 365 days Excel ! File not loaded completely max 10,48,576 rows One small canteen, one simple table, and already too big for the tool everyone uses. myphatshala.in
Riya

Sir, the canteen file is too big for Excel. So this is big data, right?

Arjun Sir

Not yet, Riya. About thirteen and a half lakh rows is too many for Excel, which stops at 10,48,576 rows. But a laptop with Python can read that file in a few seconds. Big data starts when even a good server struggles.

Riya

Then what is big data? Just… a really, really big file?

Arjun Sir

Size is only one part. Think of UPI as a whole: every single month it handles more than ten billion payments. They arrive every second, in different formats, some are duplicated or broken, and the bank must spot fraud within moments. That's Volume, Velocity, Variety, Veracity and Value.

Riya

The 5 Vs! I've seen that in the syllabus.

Kabir

Sir, can I join in? I'm Riya's friend Kabir. I have an internship offer from TiffinGo, a food-delivery startup in Pune, starting next semester. They told me their data is “big”. How will I know if it really is?

Arjun Sir

Welcome, Kabir. That is exactly the right question. Today you won't just memorise the 5 Vs. You'll measure them on real data with Python, estimate sizes with simple arithmetic, and see why each V breaks the normal tools.

Riya

And the advanced part?

Arjun Sir

How engineers put a number on each V, why systems are built for the peak and not the average, and why old data is moved to cheaper storage as its value falls.

2 Definition

What is big data?

Formal definition (write this in exams)

Big data refers to data sets whose volume, velocity or variety is so large that traditional tools, such as a single relational database or a spreadsheet on one machine, cannot capture, store, process and analyse them within an acceptable time and cost. It is commonly described by the 5 Vs: Volume, Velocity, Variety, Veracity and Value.

In simple words

Big data is data that is too big, arrives too fast, or is too mixed for one computer and normal software to handle. It is often messy, and it's only worth collecting if you can get something useful out of it.

Words you'll meet in this lesson

RecordOne unit of data, such as one order, one payment or one click. A row in a table, or one JSON object.
Structured dataData with fixed columns and types, like a SQL table or a clean CSV.
Semi-structured dataData with labels but no fixed table shape: JSON, XML, log lines.
Unstructured dataData with no labels at all: photos, videos, audio, PDFs, free-text reviews.
ThroughputHow many records arrive or are processed per second. It measures velocity.
Data qualityHow correct, complete and consistent the data is. It measures veracity.

How big is big? Units of data

UnitSizeTo picture it
Byte8 bitsOne English letter, such as A
KB (kilobyte)1,024 bytesAbout 4 UPI payment records (≈ 250 bytes each)
MB (megabyte)1,024 KBOne phone photo is 2–5 MB
GB (gigabyte)1,024 MBA full-length movie, or about 43 lakh payment records
TB (terabyte)1,024 GBA typical laptop disk; about 440 crore payment records
PB (petabyte)1,024 TBThe data platforms of large banks, telecom and e-commerce companies
EB (exabyte)1,024 PBTotal storage of the very largest internet companies
ZB (zettabyte)1,024 EBIndustry estimates put the data the whole world creates in a year at well over 100 ZB
YB (yottabyte)1,024 ZBNo organisation stores anything close to this yet

Two ways of counting: computers count in powers of 2 (1 KB = 1,024 bytes; the official names are KiB, MiB, GiB), while disk makers count in powers of 10 (1 kB = 1,000 bytes). That is why a “1 TB” disk shows about 931 GB on your computer.

Quick memory trick: each step up is about a thousand times bigger. “Kids Make Great Tea, Papa Enjoys Zero Yelling” gives KB, MB, GB, TB, PB, EB, ZB, YB in order.

The 5 Vs at three levels

Pick your level. New to this? Start at Beginner and climb.

Beginner Big data in your own phone

You already use big data systems every day. Each app below is dealing with all five Vs at once:

  • UPI: billions of payments a month (volume), each answered in about a second (velocity).
  • YouTube and Instagram: videos, photos, comments and likes together (variety).
  • Google Maps: live speed from millions of phones, some of them wrong or stale (veracity).
  • Shopping apps: “customers also bought” suggestions that increase sales (value).

Easy test: if one laptop or one database can store it and answer in time, it is not big data yet, however important it is.

Intermediate Putting a number on each V

Engineers don't say “we have a lot of data”. They measure each V:

VWhat engineers measureExample
VolumeTB stored, GB added per day, growth per year78 GB of new payments a day, growing 40% a year
VelocityEvents per second (average and peak), allowed delay (latency)4,000/s average, 30,000/s peak, reply within 1 s
VarietyNumber of sources and formats, how often their structure changes12 sources: tables, JSON, logs, images
Veracity% duplicates, % missing values, % failing checks0.4% duplicates from retries
ValueMoney saved or earned vs cost to store and processFraud blocked worth ₹2 crore vs ₹15 lakh platform cost

More Vs you may see: Variability (the rate or meaning changes, such as order spikes on festivals, or the word “cool” meaning cold or nice) and Visualisation (showing huge data so people can understand it). Some books list 7 or even 10 Vs; most university syllabi ask for 5.

Advanced Peaks, value decay and the cost of keeping data

  • Design for the peak: the peak-to-average ratio (peak events per second ÷ average) decides capacity. A system that copes with the average fails on Diwali night or after a cricket final.
  • Value falls with age: a payment record is worth most in the first second (fraud check), less after a day (disputes), and much less after a year (audits, model training). So data moves from hot (fast, costly) to warm to cold (cheap archive) storage, and is deleted or anonymised when retention ends.
  • Law sets minimums: Indian anti-money-laundering rules require banks to keep transaction records for at least five years, and the RBI requires payment-system data to be stored in India. Retention and location are design inputs, not afterthoughts.
  • Working set vs total data: a company may store 2 PB but query only the last 30 days (40 TB) daily. Size the compute for the working set and the storage for the total.
  • Don't over-engineer: a 5 GB problem on a Spark cluster is slower and costlier than one good machine. The right question is always “which V actually breaks our current tool?”

Exam tip: The first three Vs (Volume, Velocity, Variety) were described by analyst Doug Laney in 2001. Veracity and Value were added later by industry. If a question asks for “3 Vs”, write the first three; for “5 Vs”, write all five with one example each.

3 Types and ways to use it

The 5 Vs, one by one

1. Volume: how much

The total amount of data. Terabytes and petabytes, not megabytes. A bank stores every transaction for years because regulators require it.

Size

2. Velocity: how fast

The speed at which data arrives and must be handled. Thousands of payments per second at lunchtime, each needing an answer in a second or two.

Speed

3. Variety: how mixed

Different shapes of data: tables, JSON, logs, photos, voice notes, reviews. One system must store and use all of them.

Formats

4. Veracity: how trustworthy

Real data is messy: duplicates, missing fields, wrong values, fake accounts. You must clean and check before you trust a number.

Quality

5. Value: how useful

Data costs money to store. It is only worth it if it leads to decisions: stopping fraud, recommending products, planning stock.

Purpose

Three kinds of data (Variety in detail)

KindWhat it looks likeExamplesStored in
StructuredFixed columns, fixed typesBank transactions table, marks sheet, inventoryRDBMS (MySQL, Oracle), data warehouse
Semi-structuredLabelled fields, shape can varyJSON from an app, server log lines, XML, email headersNoSQL (MongoDB), data lake files
UnstructuredNo fields at allCCTV video, call recordings, scanned PDFs, tweets, product photosObject storage (HDFS, Amazon S3) + special processing

Most estimates say that the large majority of the world's new data is unstructured or semi-structured. That is one big reason traditional table-only databases are not enough. Lesson 2.1 goes deeper into each kind, and Lesson 2.2 into the file formats used to store them.

Is it big data? A quick test

Not big data

A school's marks of 2,000 students. One MySQL table or one Excel sheet handles it easily, even with complex reports.

Small

Borderline

The canteen’s 13.5 lakh orders. Too big for Excel, but one laptop with Python or one database handles it in seconds.

Medium

Big data

All UPI payments in India, every second, with fraud checks in real time, stored for years. No single machine can do this.

Big

Rule of thumb: data is “big” when you need more than one machine to store it or process it in time. That's exactly what the next two lessons explain.

4 Step by step

Follow one ₹20 chai payment through the 5 Vs

  1. One payment becomes one record

    {"txn_id": "T1001", "payer": "riya@okbank", "payee": "canteen@upi",
     "amount": 20, "time": "2026-10-19 08:01:07", "status": "SUCCESS"}
    This record is about 130 characters. With extra fields that real systems keep (device, location, bank codes), a payment record is a few hundred bytes. Small. On its own, this is not big data.
  2. Volume: multiply by everyone

    per_record = 250                    # bytes
    per_month = 10_000_000_000          # 10 billion payments
    print(per_record * per_month / 1024**4, "TB per month")
    2.2737367544323206 TB per month
    About 2.3 TB a month just for the basic records, and banks keep them for years, with copies for safety. Add logs, fraud scores and app clicks, and you are into petabytes.
  3. Velocity: they don't arrive evenly

    per_second_avg = 10_000_000_000 / (30 * 24 * 3600)
    print(round(per_second_avg), "payments per second on average")
    3858 payments per second on average
    Nearly 4,000 per second on average. At lunch, on salary day or during a sale, the peak is several times higher. Each one needs a fraud check and a reply in about a second.
  4. Variety: the payment is not alone

    Around the same payment, the systems also receive the app's click logs (JSON), an SMS (text), the canteen's menu photo, and Riya's 5-star review with a comment.

    One table cannot hold all of these. Big data platforms store raw files of any format in a data lake, and process each kind with suitable tools.
  5. Veracity: some records are wrong

    Riya's network dropped once, so the app retried and the same T1001 arrived twice. Another record has "amount": -20, and one has no payer at all.

    If you sum blindly, the canteen's income is wrong. Pipelines remove duplicates, reject invalid rows and log them for checking. Clean data first, numbers later.
  6. Value: turn records into decisions

    After cleaning, patterns appear: chai sells most at 8 am and 4 pm; samosas run out by 1 pm; one account is paying from five cities in ten minutes.

    The canteen stocks more samosas before 1 pm, and the bank blocks the suspicious account. Storing data has a cost; value is what pays for it.
5 See it happen

A ₹20 payment: what Riya sees, and what the data platform sees

Step through the six frames. Left: Riya's phone. Right: the same moment for the systems behind it.

One payment, five Vs 6 steps
What you see Scan & Pay Annapurna Canteen ₹20 PAY Paymentsuccessful ₹20 Txn T1001 · 08:01 SMS · Bank Rs 20 debited… Notification Paid to Canteen Two messages arrive in under a second. Rate your order ★★★★★ “Best cutting chai on campus!” + a photo of the chai Pending… Weak network. The app retries automatically. Cashback! ₹5 on your 10th chai “Samosas fresh at 12:30 today” myphatshala.in
Behind the screen one record {"txn_id": "T1001", "payer": "riya@okbank", "amount": 20, "status": "SUCCESS", …} A few hundred bytes. Tiny on its own. VOLUME 1 record ≈ 250 bytes 1 day ≈ 78 GB 1 month ≈ 2.3 TB 7+ years kept, with copies → PB More than one disk, more than one machine. VELOCITY ~4,000 / sec average; lunchtime peaks are far higher each needs a fraud check in ~1 second VARIETY Structured payment table Semi-structured {"event":"click", "screen":"pay"} 08:01 INFO sms ok app logs, SMS log Unstructured “Best chai…” photo, review text One payment, three shapes of data. VERACITY T1001 riya 20 SUCCESS✓ keep T1001 riya 20 SUCCESSduplicate T1002 aman -20 SUCCESSbad amount T1003 ???? 25 SUCCESSno payer Sum everything blindly → ₹45 (wrong). Clean first → ₹20 (right). VALUE 8am11am1pm4pm7pm samosas sold out Decision: fry more samosas at 12:30. Decision: reward regular customers. myphatshala.in

Traditional data vs big data

Traditional dataBig data
SizeMB to a few GBTB to PB and beyond
ArrivesIn batches: daily, monthlyContinuously, thousands of records per second
ShapeMostly structured tablesStructured + semi-structured + unstructured
Runs onOne server or one PCA cluster of many machines
Typical toolsExcel, MySQL, OracleHDFS, Hadoop, Spark, Kafka, Hive, NoSQL, cloud storage
6 Real-world use

Real-time scenarios: the 5 Vs under pressure

Three live scenarios: velocity breaking a single server on match night, all five Vs lighting up in the first seconds of a midnight sale, and an advanced one about how a record's value falls with age and where it should be stored at each stage.

Real-time scenario 1

Cricket final night at a food-delivery app

On a normal evening, orders arrive steadily. During a big cricket final, they come in waves: at the toss, in the innings break, and after the last ball. Watch velocity break a single database, and a big data setup absorb it.

Velocity on a match night 5 steps
Animated example orders per minute (illustrative) toss innings break last ball One database serverCPU, disk, network: limited Coping fine ✓ Queue piling up!orders time out A bigger server costs a lot, and has a ceiling too. Stream (Kafka) → many machines share the load workerworkerworkerworkerworkerworker Peak absorbed. Add machines when needed. myphatshala.in
Real-time scenario 2

Midnight sale: all five Vs in the first ten minutes

An online shop's big festive sale starts at 00:00. The data team sits in front of a live dashboard. Watch each V light up as crores of shoppers arrive at once.

Live 5 Vs dashboard 5 steps
Animated example VOLUMEVOLUMEVELOCITYVELOCITYVARIETYVARIETYVERACITYVERACITYVALUEVALUE 23:58:00 Sale starts at midnight · 3,000 orders per second Every V looks calm. The team waits. 00:00:05 60,000 / sec 00:00 Velocity: 20 times normal in five seconds. Volume: about 1 crore cart events in the first 10 minutes. { } payment JSON “red shoes” search text product photos where's my order? support chat Variety: one second of the sale produces all four. A table alone can't hold them. A data lake keeps each in its raw form. add-to-cart · 200 requests/s from one IPbot · blocked payment P88 · sent twice (retry)duplicate · dropped order O1043 · Riya · ₹1,299genuine ✓ Veracity: about 1 in 12 cart requests come from scripts. Count them and the dashboard lies. Clean in the stream, then count. Phone X stock · Pune warehouse92% sold Phone X stock · Mumbai warehouse35% sold Move stock Mumbai → Pune Pause Phone X ads in Pune Value: decisions in minutes, while the sale is on. myphatshala.in
Real-time scenario 3 · advanced

The life of one payment record: value falls, so cost must fall too

Riya's ₹20 chai payment is stored for years. But it is not equally useful all that time. Follow the record as it ages and see where a sensible platform keeps it at each stage.

Value decay and storage tiers 5 steps
Animated example value of the record time since payment (not to scale) 1 second1 day1 month1 year8 years Stream state, in memory (costliest per GB)The fraud check, within a second. The record is worth the most now.Hot storage: fast SSD databasesThe customer’s payment history, refunds and disputes.Warm storage: data warehouse or lakeMonthly statements, reports and analytics.Cold archive: cheap object storageAudits, fraud-model training, rare look-ups.End of retention: delete or anonymiseThe law sets the minimum, e.g. 5 years for bank records. myphatshala.in

Where else the 5 Vs show up at work

₹!

1. Banks: catching fraud in real time

Every card and UPI payment is scored for fraud within moments: is this device new, is the location unusual, is the amount strange for this customer? That's velocity (answer fast), volume (years of history per customer) and veracity (don't block genuine payments).

Payment→Fraud model + customer history→Allow / block

2. E-commerce: “customers also bought”

Shopping sites record every search, click, cart and purchase from crores of users. Big data jobs find patterns overnight, and recommendations update as you browse. Variety matters: product photos, reviews and clicks are used together.

Clicks + orders→Spark jobs find patterns→Recommendations
1.4×

3. Ride-hailing: surge pricing and ETAs

Cabs send GPS locations every few seconds. The platform combines millions of location points with ride requests to estimate arrival times and set prices zone by zone. That's velocity and volume at once.

GPS pings→Stream processing by zone→ETA + price
call records

4. Telecom: network health from call records

Mobile operators collect a record for every call, SMS and data session, plus logs from every tower. Analysing them finds congested towers, dropped-call hotspots and customers likely to switch operators.

Tower logs + CDRs→Hadoop / Spark analysis→Fix towers, offers

5. Agriculture and weather

Satellite images (unstructured, huge) and weather-station readings are combined to estimate crop health, forecast rain and plan insurance payouts for farmers. Each image alone can be hundreds of megabytes.

Satellite + sensors→Image + time-series processing→Crop advice

Examples are simplified to show where each V matters. Real setups vary by company.

7 Run the code

Measure the 5 Vs yourself

A tiny slice of the canteen's data: six payment records as JSON text, two photos and a review. The program measures each V. Read it first, then try the challenges, which include an Excel-limit calculator, a size converter and a record that breaks the program.

import json

# Six payment events, as they arrive from the app (JSON text)
events = [
    '{"id": "T1", "item": "chai", "amount": 20, "sec": 1}',
    '{"id": "T2", "item": "vada pav", "amount": 25, "sec": 1}',
    '{"id": "T3", "item": "chai", "amount": 20, "sec": 2}',
    '{"id": "T2", "item": "vada pav", "amount": 25, "sec": 1}',
    '{"id": "T4", "item": "samosa", "amount": -15, "sec": 2}',
    '{"id": "T5", "item": "chai", "amount": 20, "sec": 3}',
]
data = {"json": events, "image": ["chai.jpg", "menu.png"], "text": ["Best chai!"]}

# VOLUME: how much data?
size = sum(len(e) for e in events)
print("Volume  :", len(events), "records,", size, "bytes")

# VELOCITY: how fast does it arrive?
records = [json.loads(e) for e in events]
seconds = len({r["sec"] for r in records})
print("Velocity:", len(records) / seconds, "records per second")

# VARIETY: how many kinds of data?
print("Variety :", len(data), "kinds ->", ", ".join(data))

# VERACITY: how many records can we trust?
seen, clean, bad = set(), [], 0
for r in records:
    if r["id"] in seen or r["amount"] <= 0:
        bad += 1
        continue
    seen.add(r["id"])
    clean.append(r)
print("Veracity:", bad, "bad records out of", len(records))

# VALUE: what does the clean data tell us?
sales = {}
for r in clean:
    sales[r["item"]] = sales.get(r["item"], 0) + r["amount"]
print("Value   : income Rs", sum(sales.values()), "| best seller:", max(sales, key=sales.get))
Volume : 6 records, 323 bytes Velocity: 2.0 records per second Variety : 3 kinds -> json, image, text Veracity: 2 bad records out of 6 Value : income Rs 85 | best seller: chai
  • json.loads(e)Turns JSON text into a Python dictionary. Real pipelines do this millions of times per second, which is part of why velocity is hard.
  • len({r["sec"] for r in records})A set keeps only unique values, so this counts how many different seconds the records arrived in.
  • r["id"] in seenThe retry sent T2 twice. Without this check the income would be counted twice: a veracity problem.
  • r["amount"] <= 0A payment of −15 is impossible, so it is rejected instead of silently reducing the total.
  • max(sales, key=sales.get)Finds the item with the highest sales: a small example of turning data into a decision (value).

Run it on your PC: make a file Excel can't open

This program writes 15 lakh fake canteen orders to orders.csv (about 39 MB). Save it as gen_orders.py and run it with Python on your own computer. Then try opening the CSV in Excel. The second program reads the same file with Python in about two seconds. That is the point: too big for Excel is not the same as big data.

Create 15 lakh rows

import csv, os, random, time

random.seed(7)
items = [("chai", 20), ("coffee", 25), ("vada pav", 25), ("samosa", 15), ("poha", 30)]
start = time.time()
with open("orders.csv", "w", newline="") as f:
    w = csv.writer(f)
    w.writerow(["txn_id", "item", "amount", "mode", "day"])
    for i in range(1, 1_500_001):
        item, price = random.choice(items)
        w.writerow([f"T{i}", item, price, random.choice(["UPI", "cash"]), i // 3700 + 1])
secs = time.time() - start
print("Rows written :", 1_500_000)
print("File size    :", round(os.path.getsize("orders.csv") / 1024**2, 1), "MB")
print("Time taken   :", round(secs, 1), "seconds")
print("Excel limit  :", 1_048_576, "rows -> this file is too big for one sheet")

# In a terminal:  python gen_orders.py
Rows written : 1500000 File size : 38.8 MB Time taken : 2.3 seconds Excel limit : 1048576 rows -> this file is too big for one sheet

Output recorded from a real run. Your time will differ with your computer's speed; the row count and size will match. Opening this file in Excel shows “File not loaded completely” and keeps only the first 10,48,576 rows.

Read all 15 lakh rows with Python

import csv, time
from collections import Counter

start = time.time()
sales = Counter()
with open("orders.csv") as f:
    for row in csv.DictReader(f):
        sales[row["item"]] += int(row["amount"])
print("Read 15 lakh rows in", round(time.time() - start, 1), "seconds")
for item, rs in sales.most_common():
    print(f"{item:10} Rs {rs:,}")

# In a terminal:  python read_orders.py
Read 15 lakh rows in 2.1 seconds poha Rs 8,989,200 coffee Rs 7,512,175 vada pav Rs 7,485,075 chai Rs 6,013,200 samosa Rs 4,497,150

Recorded from a real run. One ordinary computer handles this easily, so it is not big data. Make it 1,500 crore rows arriving every day and one computer is no longer enough. Lesson 1.2 shows exactly where it breaks.

8 Line by line

Cleaning payments, one line at a time

Veracity in action. Four records arrive: one is a duplicate caused by a retry, and one has an impossible amount. Step through and watch seen, income and the console. Objects #1 (the list) and #2–#5 (each record is a tuple) live on the heap.

Worked examples: real problems, solved and traced in memory

Four problems, from beginner to advanced. Each program runs live, and each is traced so you can see how the data builds up in memory.

Example 1BeginnerRetail · Volume

How much data does a supermarket chain create?

Problem statement

A supermarket chain has 2,000 stores. Each store prints about 400 bills a day, and each bill record is about 600 bytes. How much bill data does one store create in a year, and how much does the whole chain create?

Input
600 bytes × 400 bills × 365 days × 2000 stores
Expected output
One store per year : 83.5 MB
Whole chain per year: 163.2 GB

Approach

  1. Multiply bytes per bill by bills per day and days per year for one store.
  2. Multiply by the number of stores for the chain.
  3. Convert bytes to MB (÷ 1024²) and GB (÷ 1024³) so the numbers are readable.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 2BeginnerMedia · Variety

Sort a folder by kind of data

Problem statement

A company's shared folder has files from many teams. Count how many files are structured, semi-structured and unstructured, using the file extension.

Input
sales.csv, cctv.mp4, app_log.json, invoice.pdf, stock.csv, server.log, review.txt
Expected output
{'structured': 2, 'unstructured': 3, 'semi-structured': 2}

Approach

  1. Make a dictionary that maps known extensions to a kind.
  2. For each file, take the part after the last dot.
  3. Look it up; anything unknown counts as unstructured. Count each kind in another dictionary.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 3IntermediateFood delivery · Velocity

Find the busiest minute

Problem statement

A food-delivery app logs the minute of every order. Find how many orders arrived in each minute, and the peak minute. Systems must be built for the peak, not the average.

Input
13:00, 13:00, 13:01, 13:01, 13:01, 13:02
Expected output
Orders per minute: {'13:00': 2, '13:01': 3, '13:02': 1}
Peak: 13:01 with 3 orders
Average: 2.0 orders per minute

Approach

  1. Count orders per minute in a dictionary.
  2. Use max with key=per_min.get to find the minute with the highest count.
  3. Compare the peak with the average.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

Example 4AdvancedFintech · capacity planning

How much storage will we need in five years?

Problem statement

A payments company adds 78 GB of new records a day today, and the daily amount grows 40% a year. Records are kept for at least five years. The platform keeps 3 copies of every file for safety, and the Parquet format compresses the data about 4 times. How much disk is needed at the end of each year?

Input
78 GB/day, 40% growth, 3 copies, 4× compression, 5 years
Expected output
Year 1: raw   27.8 TB -> disk   20.9 TB
Year 2: raw   66.7 TB -> disk   50.0 TB
Year 3: raw  121.2 TB -> disk   90.9 TB
Year 4: raw  197.5 TB -> disk  148.1 TB
Year 5: raw  304.3 TB -> disk  228.2 TB

Approach

  1. Year 1 adds 78 × 365 GB. Each later year adds 40% more than the year before: multiply by 1.4 each time.
  2. Keep a running total of raw data, because old data is not deleted within five years.
  3. Stored size = raw total × copies ÷ compression. Convert GB to TB by dividing by 1024.

Solution: run it live

What happens in memory, step by step

Recorded from a real Python run: press Next to execute one line at a time. Watch variables change in each frame, and lists and dictionaries (numbered #1, #2 …) fill up as objects.

9 Quiz and revision

Check yourself

Quick revision

Lesson 1.1 in one screen

  • Big data = too big, too fast or too varied for traditional single-machine tools.
  • Volume (how much) · Velocity (how fast) · Variety (how mixed) · Veracity (how trustworthy) · Value (how useful).
  • First 3 Vs: Doug Laney, 2001. Veracity and Value added later.
  • Structured (tables) · semi-structured (JSON, logs, XML) · unstructured (photos, video, audio, free text).
  • Units: KB → MB → GB → TB → PB → EB, each × 1024.
  • Excel holds 10,48,576 rows per sheet. Too big for Excel ≠ big data.
  • Rule of thumb: it is big data when you need more than one machine to store or process it in time.
  • Engineers measure each V: TB and growth (volume), events per second and latency (velocity), sources and formats (variety), % bad records (veracity), money gained vs cost (value).
  • Design for the peak, not the average. Peak-to-average ratio = peak rate ÷ average rate.
  • Value falls with age: memory → hot → warm → cold → delete or anonymise when retention ends.
  • Extra Vs: Variability (rate or meaning changes) and Visualisation.

Interview and viva questions

What is big data? Explain the 5 Vs with examples.

Big data is data whose size, speed or variety exceeds what traditional single-machine tools can handle in acceptable time. Volume: UPI's billions of monthly payments. Velocity: thousands of payments per second needing fraud checks. Variety: tables, JSON logs, photos and reviews together. Veracity: duplicate and broken records that must be cleaned. Value: the decisions the data enables, such as blocking fraud or planning stock.

What is the difference between structured, semi-structured and unstructured data?

Structured data has a fixed schema of columns and types (SQL tables). Semi-structured data has labels or tags but a flexible shape (JSON, XML, logs). Unstructured data has no predefined model (images, video, audio, free text). Each needs different storage and processing.

Is a 10 GB CSV file big data?

Usually not. A single modern machine can process 10 GB with tools like Python, Pandas (in chunks) or a database. It becomes big data when the size, arrival speed or processing deadline needs a cluster of machines.

Why is veracity important?

Because wrong data leads to wrong decisions. Duplicates inflate totals, missing values bias averages and fake records hide fraud. Big data pipelines spend a lot of effort on validation, de-duplication and cleaning before analysis.

Why can't traditional RDBMS handle big data well?

A traditional RDBMS usually runs on one server, so it is limited by that machine's disk, memory and CPU, and scaling up gets very expensive. It also expects a fixed schema, while big data includes semi-structured and unstructured data. Big data systems spread storage and processing across many cheaper machines.

Are there more than 5 Vs of big data?

Yes. Some authors add Variability (the rate or meaning of data changes over time), Visualisation (presenting huge data so people can understand it), Validity and Volatility, giving 7 or 10 Vs. Most syllabi and interviews expect the 5 Vs: Volume, Velocity, Variety, Veracity and Value. Mention Variability as the common sixth.

Why are systems designed for peak load and not average load?

Because customers arrive in bursts: festival sales, salary days, the end of a cricket match. If capacity matches the average, the system fails exactly when demand is highest. Engineers measure the peak-to-average ratio and design for the peak with some headroom, often scaling machines up automatically for known peaks.

Practice problems

Small programs about measuring and cleaning data. The last three are business tasks you could meet in a data engineering interview.

P1Easy

TB to GB

A company stores 5 TB of logs. Print how many GB that is (1 TB = 1024 GB).

Input
5 TB
Expected output
5120 GB
Show solution and explanation
tb = 5
print(tb * 1024, "GB")
5120 GB

How it works: Each step up the unit ladder is × 1024.

P2Easy

Count records and bytes

Given a list of three log lines, print how many records there are and their total size in bytes (one character = one byte here).

Input
3 log lines
Expected output
Records: 3
Bytes: 54
Show solution and explanation
logs = ["08:01 INFO login riya", "08:02 INFO pay 20", "08:02 WARN retry"]
print("Records:", len(logs))
print("Bytes:", sum(len(x) for x in logs))
Records: 3 Bytes: 54

How it works: len of a string is its number of characters; sum adds them up.

P3Easy

Room left in Excel

A report already has 2,50,000 rows. How many more rows fit in one Excel sheet (limit 1,048,576)?

Input
250000
Expected output
Rows left: 798576
Show solution and explanation
used = 250_000
print("Rows left:", 1_048_576 - used)
Rows left: 798576

How it works: Underscores in numbers are allowed in Python and make big numbers readable.

P4Medium

Remove duplicate orders

Remove duplicate order ids but keep the first occurrence and the original order.

Input
T1, T2, T1, T3, T2
Expected output
['T1', 'T2', 'T3']
Show solution and explanation
orders = ["T1", "T2", "T1", "T3", "T2"]
seen, unique = set(), []
for o in orders:
    if o not in seen:
        seen.add(o)
        unique.append(o)
print(unique)
['T1', 'T2', 'T3']

How it works: The set gives fast “already seen?” checks; the list keeps the order.

P5Medium

Count missing values

Count how many records are missing a city (the value is None or an empty string).

Input
4 customer records
Expected output
Missing city: 2 of 4
Show solution and explanation
customers = [
    {"name": "Riya", "city": "Pune"},
    {"name": "Aman", "city": None},
    {"name": "Neha", "city": ""},
    {"name": "Kabir", "city": "Mumbai"},
]
missing = sum(1 for c in customers if not c["city"])
print("Missing city:", missing, "of", len(customers))
Missing city: 2 of 4

How it works: Both None and "" are “falsy”, so not c["city"] catches both.

P6Advanced

Peak-to-average ratio

Orders per minute during one evening are given. Print the average, the peak and the peak-to-average ratio (one decimal place).

Input
[120, 135, 980, 140, 110, 1250, 130]
Expected output
Average: 409.3
Peak: 1250
Peak-to-average ratio: 3.1
Show solution and explanation
per_minute = [120, 135, 980, 140, 110, 1250, 130]
average = sum(per_minute) / len(per_minute)
peak = max(per_minute)
print("Average:", round(average, 1))
print("Peak:", peak)
print("Peak-to-average ratio:", round(peak / average, 1))
Average: 409.3 Peak: 1250 Peak-to-average ratio: 3.1

How it works: The ratio tells you how much spare capacity the system needs above the average. A ratio above 3 already means a system sized for the average will fail during the rush.

P7Advanced

Data quality score

Check each payment record: a missing id, an amount of zero or less, and a repeated id are problems. Count each problem and print the percentage of good records.

Input
6 records
Expected output
{'missing id': 1, 'bad amount': 1, 'duplicate': 1}
Quality score: 50% good records
Show solution and explanation
records = [
    {"id": "T1", "amount": 20}, {"id": "T2", "amount": -5},
    {"id": "T1", "amount": 20}, {"id": None, "amount": 30},
    {"id": "T3", "amount": 45}, {"id": "T4", "amount": 15},
]
seen = set()
problems = {"missing id": 0, "bad amount": 0, "duplicate": 0}
good = 0
for r in records:
    if r["id"] is None:
        problems["missing id"] += 1
    elif r["amount"] <= 0:
        problems["bad amount"] += 1
    elif r["id"] in seen:
        problems["duplicate"] += 1
    else:
        seen.add(r["id"])
        good += 1
print(problems)
print(f"Quality score: {good / len(records) * 100:.0f}% good records")
{'missing id': 1, 'bad amount': 1, 'duplicate': 1} Quality score: 50% good records

How it works: Each record is checked in order and counted under its first problem. Real pipelines publish this score every day so a sudden drop (for example, a broken app release) is noticed before anyone trusts the numbers.

P8Business problem

Monthly cloud storage bill

A fintech stores 2.3 TB of new payment data every month and keeps all of it. Cloud storage costs Rs 1.80 per GB per month (illustrative). Print the bill for month 1 and month 12.

Input
2.3 TB per month, Rs 1.80/GB-month
Expected output
Month 1 : Rs 4239
Month 12 : Rs 50872
Show solution and explanation
new_gb = 2.3 * 1024
rate = 1.80
for month in [1, 12]:
    stored = new_gb * month
    print("Month", month, ": Rs", round(stored * rate))
Month 1 : Rs 4239 Month 12 : Rs 50872

How it works: Data accumulates, so the bill grows every month. This is why companies set retention rules: Volume has a cost, so it must create Value.

P9Business problem

Average payments per second

A payments company processed 1,800 crore transactions last month (30 days). Print the average per second.

Input
18,000,000,000 in 30 days
Expected output
6944 per second on average
Show solution and explanation
txns = 18_000_000_000
seconds = 30 * 24 * 3600
print(round(txns / seconds), "per second on average")
6944 per second on average

How it works: 30 × 24 × 3600 = 25,92,000 seconds in the month. Peaks are several times the average.

P10Business problem

Busiest hour for staffing

A canteen logs the hour of each order. Print the hour with the most orders so the owner can put an extra person on the counter.

Input
hours: 8, 9, 13, 13, 16, 13, 8, 16, 13
Expected output
Busiest hour: 13 with 4 orders
Show solution and explanation
hours = [8, 9, 13, 13, 16, 13, 8, 16, 13]
count = {}
for h in hours:
    count[h] = count.get(h, 0) + 1
busiest = max(count, key=count.get)
print("Busiest hour:", busiest, "with", count[busiest], "orders")
Busiest hour: 13 with 4 orders

How it works: Count with a dictionary, then pick the key with the highest value. Data → decision is Value.

Real-world scenario questions (asked in company interviews)

Situations freshers and junior data engineers really face. Decide your answer first, then open the model answer.

Retail · tool choiceFresher

“Let's set up Hadoop for our sales data”

A mid-sized retailer has 5 GB of sales data, growing by about 1 GB a year. A manager read about big data and wants to set up a Hadoop cluster. You are asked for your opinion.

The interviewer is checking: can you judge whether data is really “big”, instead of picking tools because they are popular?

Show a strong answer

5 GB growing at 1 GB a year is not big data. One database server (PostgreSQL or MySQL) or Python with Pandas handles it comfortably, and reports will run in seconds.

  • A cluster adds cost, setup and maintenance with no benefit at this size.
  • Put the data in a proper database, index it, and build reports or a BI dashboard on top.
  • Revisit if the data grows by orders of magnitude, for example if clickstream or real-time data is added.

Avoid saying: “More data tools are always better.” Use the simplest tool that meets the need.

Fintech · data qualityFresher

The dashboard shows more money than the bank

The daily revenue dashboard shows ₹12.4 lakh, but the bank settlement says ₹11.9 lakh. Engineering says the app sometimes retries payments when the network is slow.

The interviewer is checking: do you recognise a veracity problem and know how to fix it at the source and in the pipeline?

Show a strong answer

Retries are probably creating duplicate records for the same payment, so they are counted twice.

  1. Check for repeated transaction ids in the raw data for that day, and compare totals after removing them.
  2. De-duplicate in the pipeline on a unique key (transaction id) before calculating revenue.
  3. Fix the source: make the payment API idempotent, so a retry with the same id doesn't create a new record.
  4. Add a daily reconciliation check against the bank settlement that alerts when they differ.

Avoid: “adjusting” the dashboard number by hand without finding the cause.

E-commerce · storage cost1–3 years

“Keep everything forever, just in case”

Your team stores every click from the app forever. The storage bill grows every month, and nobody has used clicks older than a year. Your lead asks what you would propose.

The interviewer is checking: do you understand that Volume has a cost and must be balanced against Value, and that personal data has legal limits?

Show a strong answer

Data should be kept as long as it creates value or is legally required, and no longer.

  • Agree a retention policy with the business: for example, raw clicks for 90 days, daily summaries for years.
  • Move older data to cheaper archive storage, and compress it into columnar formats like Parquet.
  • Remove or anonymise personal data that isn't needed. Privacy laws such as India's Digital Personal Data Protection Act, 2023 expect personal data not to be kept longer than necessary.

Avoid: deleting data without checking legal and audit requirements first.

Telecom · customer support1–3 years

Analysing call recordings with sales data

The support head wants to know why customers cancel. The evidence is spread across a sales database (tables), chat transcripts (JSON) and call recordings (audio files). How would you bring them together?

The interviewer is checking: can you handle Variety: different shapes of data that must be linked?

Show a strong answer

Store all three in a data lake in their raw form, then convert each into something that can be joined.

  • Audio → text with a speech-to-text service, then text → topics or sentiment.
  • Chat JSON → flatten into rows: customer id, time, message, topic.
  • Join everything on customer id with the sales tables, and compare customers who cancelled with those who stayed.

Avoid: forcing audio and JSON into one rigid table before you know which fields matter.