Cohort 4Register

START HERE

Start here: the running dataset

FreeLesson 1 of 78

The same online store from the SQL End to End Notes, now as the files a data engineer actually receives: CSV, JSON, JSON Lines and a log file.

These notes take you from Python basics to the patterns that decide DE coding rounds, then into pandas, databases, testing and PySpark. The pattern section comes from the questions I keep seeing across the 20+ analytics and data engineering interviews I have sat, and the ones my mentees report back from their own loops. Every snippet reads the files below, and every output panel is what Python 3.12 printed when this PDF was built. The files ship with this PDF as

python_de_dataset.zip.

The files

FileFormatRecordsWhat's insideUsed for
orders.csvCSV15order_id, customer_id, order_date, status, amountMost of the book
order_items.csvCSV24order_id, product_id, qty, unit_priceGroup by, joins
products.csvCSV8product_id, product_name, category, priceLookups, pandas
customers.jsonJSON8Nested address {city, pincode}, tags listFlattening (P7), joins
events.jsonlJSON Lines12user_id, ts, event, props {page, device}Sessions, funnels
logins.csvCSV12user_id, login_dateStreaks (P9)
employees.csvCSV9emp_id, name, dept, manager_id, salaryTop-K, ties
app.logText14Pipeline log lines, one malformedRegex parsing (P10)
orders_dirty.csvCSV7Bad rows on purpose: negative, blank, bad dateValidation (P17)
snapshot_day1/2.csvCSV8 / 8Customers on two daysChange capture (P18)

A first look

A FIRST LOOKPYTHON 3.12
import csv, json

with open("orders.csv", newline="") as f:
    first = next(csv.DictReader(f))
print(first)

customers = json.load(open("customers.json"))
print(customers[5])

Output

{'order_id': '101', 'customer_id': '1', 'order_date': '2025-01-10', 'status': 'delivered', 'amount': '1198.00'}
{'customer_id': 6, 'name': 'Sana', 'signup_date': '2025-03-15', 'referred_by': None, 'address': {'city': None, 'pincode': None}, 'tags': []}

DA data wrangling round DE data engineering coding round EASY MEDIUM HARD difficulty

Practice before you move on

  1. Read orders.csv with csv.DictReader and print the number of rows and the column names.
  2. Print the distinct statuses in orders.csv, then the earliest and the latest order_date.
  3. Read events.jsonl one line at a time and print the set of event types it holds.