Hierarchical data on HDF5 · tables · arrays · queries · compression · verified against PyTables 3.11.x (2026)

PyTables cheat sheet

PyTables (imported as tables) manages very large datasets on top of HDF5. A file is a tree of groups holding Tables (row-oriented, NumPy-dtype records) and Arrays (dense/chunked/extendable). Open with open_file(), define a schema with IsDescription, append rows through a Row accessor, and run fast on-disk queries with table.where("expr") — all with transparent compression. Handles data far larger than RAM. Targets PyTables 3.11.x, Python 3.11+.

file & hierarchy tables queries arrays & compression metadata & ecosystem gotcha most common

Verified 2026-08-31 against the official docs at pytables.org (PyTables 3.11.1, released 2026-03-01; Python 3.11+). Import is import tables (PyPI package name is tables). Files use the .h5/.hdf5 extension and are readable by any HDF5 tool (h5py, HDFView).

Outline

Open a file, build a group tree, store Tables (records) and Arrays (dense data), then query and compress. Attributes carry metadata; pandas' HDFStore sits on top.

File & tables

  1. 1Install & open_file
  2. 2Groups & hierarchy
  3. 3Tables & IsDescription
  4. 4Append & read rows

Queries & arrays

  1. 5Querying (where)
  2. 6Arrays
  3. 7Compression & chunks
  4. 8Indexing & performance

Metadata & ecosystem

  1. 9Attributes & metadata
  2. 10HDFStore & ecosystem

File & Tables

Open an HDF5 file, organize it into groups, and define typed record tables.

1Install & open_fileimport tables
2Groups & hierarchythe tree
3Tables & IsDescriptiontyped records
4Append & read rowsthe Row accessor

Queries & Arrays

Run fast in-kernel queries; store dense/extendable arrays; compress everything.

5Querying (where)in-kernel search
6Arraysdense data
7Compression & chunksFilters
8Indexing & performancego faster

Metadata & Ecosystem

Attach metadata; interoperate with pandas and the HDF5 world.

9Attributes & metadataself-describing
10HDFStore & ecosystempandas & HDF5

Worth memorizing

import tables as tbPyPI name is `tables`
open_file(path, mode)r / w / a — always close()
create_groupdirectories under root "/"
IsDescription + *Coltyped table schema
row.append() + t.flush()stream rows in
t.append([...])bulk insert (much faster)
t.where("expr")in-kernel query (numexpr)
read_where / get_where_listmatches as array / row ids
Array / CArray / EArraydense / chunked / extendable
Filters(complevel, complib)blosc2 = fast default
col.create_index()index a column for fast queries
df.to_hdf(format="table")pandas HDF5 = PyTables