Machine learning

Stage 1 · Lesson 8 of 8

CSV, JSON and Parquet

Python for data

Data arrives in a few formats, and each has quirks. CSV is plain text that every tool can open, but it stores no types. So dates, IDs with leading zeros and all need care when you read it: pass dtype and parse_dates to read_csv.

holds nested records, like a customer with a list of orders inside, and pd.json_normalize flattens them into columns. Parquet is a compressed binary format stored column by column. It keeps each column's type and lets you read only the columns you need.

A file that is 1 GB as CSV is often 100 to 200 MB as Parquet, and it loads far faster. Convert a large CSV to Parquet once and work from that.

Common traptrusting read_csv to guess types correctly: a postcode column can quietly become an integer.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

  • The Python, Pandas and Data Visualization micro courses, in browser notebooks

Keep handy

  • Start with 10 minutes to pandas, then look up indexing, groupby and reshaping

  • Quick NumPy, pandas and Matplotlib lookups with a try-it editor

Mark this stage as not done?