pandas.HDFStore.select

pandas 3.1.1 · Input and output · method

Read an HDFStore table or object. For tables, supply where to restrict rows.

Call syntax

HDFStore.select(…) Full signature
HDFStore.select(
    key,
    where=None,
    start=None,
    stop=None,
    columns=None,
    iterator=False,
    chunksize=None,
    auto_close=False,
)

Inspect the call

Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.

Parameters

ParameterRequirementAccepted values and behavior
key Required
Positional or keyword
str

Provide the lookup key, or a transformation callable for a sorting method.

where Optional
Positional or keyword
Default None
list or None

Select data using a criterion or specify the label at which to look up a value.

start Optional
Positional or keyword
Default None
int or None

Supply the start point of a range, slice, or calculation.

stop Optional
Positional or keyword
Default None
int

Provide the endpoint where a slice or generated range stops.

columns Optional
Positional or keyword
Default None
list or None

Supply column labels or control how columns are handled.

iterator Optional
Positional or keyword
Default False
bool or False

Request an iterable reader so data can be consumed in pieces.

chunksize Optional
Positional or keyword
Default None
int or None

Set how many rows to read or write in each batch.

auto_close Optional
Positional or keyword
Default False
bool or False

Returns

object

Example for a local Python session

import pandas as pd
from pathlib import Path
from tempfile import TemporaryDirectory
import tables

frame = pd.DataFrame({"units": [2, 5], "price": [4, 3]})
with TemporaryDirectory() as folder:
    path = Path(folder) / "demo.h5"
    with pd.HDFStore(path, mode="w") as store:
        store.put("orders", frame, format="table", data_columns=["units"])
        print(store.select("orders", where="units > 2"))