Skip to content

CSV vs Parquet: Which File Format to Use for Data Pipelines

A table read row by row on one side and read one column at a time on the other.

CSV is the file format everyone can open, and Parquet is the one analytics engines prefer. They store the same table very differently, and the difference shows up in file size, query speed and how safely your data keeps its types.

How CSV stores data

A CSV file is plain text, with one row per line and values separated by commas. It is human-readable, works with almost every tool, and needs no special library. It also stores everything as text, so there are no real data types: a date, a number and an ID that happens to look like a number are all just characters. Quoting rules, delimiters inside values and differing encodings make CSV files surprisingly easy to misread.

How Parquet stores data

Parquet is a binary, columnar format. Instead of storing each row together, it stores all the values of each column together, and it keeps the schema, including column types, inside the file. Because values in one column look alike, they compress well, and the file also stores statistics about each block of values that engines can use to skip data they do not need.

Why columnar helps analytics

Analytical queries usually read a few columns from many rows, such as total sales by region. With a columnar format, an engine can read only those columns and ignore the rest, which is called column pruning. It can also use the stored statistics to skip blocks that cannot match a filter, which is called predicate pushdown. A row-based text file has to be read and parsed in full to answer the same question.

Where CSV still makes sense

CSV is a good choice for small files, for exchanging data with people or systems that cannot read anything else, and for quick inspection in a text editor or spreadsheet. It is often the format data arrives in, which is why many pipelines land the raw file unchanged, as in medallion architecture, and then convert it for analysis.

Where Parquet fits better

Parquet suits larger datasets, repeated analytical queries, and storage in a data lake, because it is smaller on disk, faster to scan and keeps types intact. It is a common format for the files behind lake and lakehouse platforms, discussed in warehouse vs lake vs lakehouse. Engines such as DuckDB can query Parquet files directly, which suits the local analytics setup in dbt vs DuckDB.

Converting between them

A simple conversion in Python reads the CSV with an explicit schema and writes it back as Parquet:

import pandas as pd

df = pd.read_csv("orders.csv", parse_dates=["order_date"])
df.to_parquet("orders.parquet", index=False)

Writing Parquet from pandas needs a Parquet engine such as pyarrow installed. Declare the types you expect when reading the CSV, so that a column of IDs is not silently turned into numbers and a date column is not left as text.

Partitioning and file size

Parquet works best as a modest number of reasonably sized files, often organized into folders by a column such as date, so that queries can skip whole folders. Very many tiny files slow engines down, and a few enormous files limit parallelism. The planning is covered in table partitioning strategies.

Other formats you will meet

Avro is a row-based binary format that carries its schema and is common for event streams and record-by-record writes. ORC is another columnar format, mainly seen in the Hadoop ecosystem. JSON is flexible for nested data but verbose and slow to scan at scale. Table formats such as Apache Iceberg and Delta Lake sit on top of Parquet files and add transactions and schema changes, which ties into schema evolution.

A quick checklist

  1. Is the file small and meant for people or simple tools? CSV is fine.
  2. Will it be queried repeatedly for analytics? Use Parquet.
  3. Did you declare column types when reading the CSV?
  4. Are your Parquet files a sensible size, not thousands of tiny ones?
  5. Did you keep the original raw file in case you need to rebuild?

If you want help moving a pipeline onto efficient storage, see my ETL and ELT engineering service.

FAQ

Is Parquet better than CSV?
For analytics on larger data, usually yes: it is smaller, faster to scan and keeps data types. CSV is better for small files and for sharing with tools that need plain text.

Why is Parquet faster to query?
It stores data by column, so engines read only the columns a query needs, and it keeps statistics that let them skip blocks of data that cannot match a filter.

Can I open a Parquet file in a text editor?
No. Parquet is binary, so you need a tool or library that reads it, such as pandas with pyarrow, DuckDB or a data viewer.

Related posts

Leave a comment

Your email address will not be published. Required fields are marked *