pip install fastparquet★Pulls numpy, pandas, cramjam, fsspec. Python 3.9+.# fastparquet is winding down — pandas 3.0 requires pyarrowretiringActive development has largely stopped. For new projects usepyarrow/df.to_parquet()(card 10). Keep using fastparquet only for existing pandas-2.x pipelines.from fastparquet import write, ParquetFile★The two names you need:write(out) andParquetFile(in).df.to_parquet("f.parq", engine="fastparquet") pd.read_parquet("f.parq", engine="fastparquet")★Most people use fastparquet via pandas by naming the engine — no direct import needed.
write("out.parq", df)★Single-file Parquet from a pandas DataFrame. The index is written by default (write_index=Falseto drop it).write("out.parq", df, compression="snappy", row_group_offsets=500_000)★row_group_offsets= row boundaries for logical segments (an int = rows per group). Row groups are the unit of read parallelism & filtering.write("dataset/", df, file_scheme="hive")★file_scheme="hive"writes a multi-file dataset directory with a_metadatafile (vs"simple"= one file).write("out.parq", df, object_encoding="utf8", times="int64")Control how object columns & timestamps are encoded when types are ambiguous.
pf = ParquetFile("out.parq") df = pf.to_pandas()★Open then materialize to a DataFrame.ParquetFilealso accepts a directory (a dataset) or a list of files.pf.columns · pf.dtypes · pf.count() · pf.info★Inspect schema & row count without reading the data — Parquet stores this in the footer.for df in pf.iter_row_groups(): process(df)★Iterate one row-group DataFrame at a time — bounded memory over a big file.
pf.to_pandas(columns=["a", "b"])★Column pushdown: read only the columns you need — the whole point of a columnar format.pf.to_pandas(filters=[("year", "==", 2026)])★Predicate/row-group pushdown: skip row groups (and partitions) whose stats can't match — big speedups on filtered reads.pf.to_pandas(columns=["city"], categories=["city"])Load low-cardinality string columns as pandascategorydtype to save memory.# filters prune whole row groups, not individual rowsnoteRow-group filtering is coarse — you still get all rows in a group that might match; re-filter the DataFrame for exact results.