liveBook · Manning

Feather

As explained in Pandas Workout: 200 exercises to make you a stronger data analyst

Feather is a binary columnar file format for efficiently storing and exchanging tabular data.

Feather is a binary format for storing and exchanging tabular data. Its binary storage and compression produce smaller files that pandas can read and write faster than CSV or JSON. section 12.4

Use Feather when a pandas workflow repeatedly saves and reloads a large data frame. Write with to_feather and reload with read_feather; the resulting data remains a pandas data frame. section 12.4

Benchmarking a large data set

For a parking-violations data set, a benchmark wrote JSON in about 46 seconds, CSV in 114 seconds, and Feather in 8 seconds. Reading took about 470 seconds for JSON, 35 seconds for CSV, and 9 seconds for Feather. The Feather file was also the smallest of the three measured outputs. section 12.6

df.to_feather('mydata.feather')

Inspect the compact pandas operation used to write a data frame as a Feather file, then compare it with the corresponding read operation. section 12.4

How Pandas Workout: 200 exercises to make you a stronger data analyst covers it

How deep it goes
Explains binary storage, compression, pandas operations, and comparative timings without detailing the Feather file specification.
Examples
Compares Feather with CSV and JSON using a large parking-violations data set, timing reads and writes and checking file sizes.
What it assumes
Assumes familiarity with pandas data frames, file I/O methods, Python dictionaries, loops, and basic elapsed-time measurement.
What you can do after
Operate/configure pandas to write and read Feather files and benchmark the resulting storage against JSON and CSV.
How it connects
Connects Feather with Apache Arrow, PyArrow, pandas, CSV, JSON, Parquet, NumPy, and cross-language data systems.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pandas Workout: 200 exercises to make you a stronger data analyst. The section links point to the parts of the book it draws on.