pandas.read_hdf
pandas 3.1.1 · Input and output · function
Load an object by key from HDF5, with row filtering available for table-format data.
Call syntax
pd.read_hdf(…) Full signature
pd.read_hdf(
path_or_buf,
key=None,
mode='r',
errors='strict',
where=None,
start=None,
stop=None,
columns=None,
iterator=False,
chunksize=None,
**kwargs,
)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
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
path_or_buf |
Required Positional or keyword |
str, path object, pandas.HDFStore Supply a file path or writable/readable stream. Some writers return the result directly when this is omitted. |
key |
Optional Positional or keyword Default None |
object Provide the lookup key, or a transformation callable for a sorting method. |
mode |
Optional Positional or keyword Default 'r' |
{'r', 'r+', 'a'} Choose a file or storage access mode. |
errors |
Optional Positional or keyword Default 'strict' |
str Choose how to handle invalid input or failed operations. The available options depend on the API. |
where |
Optional Positional or keyword Default None |
list Select data using a criterion or specify the label at which to look up a value. |
start |
Optional Positional or keyword Default None |
int 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 Supply column labels or control how columns are handled. |
iterator |
Optional Positional or keyword Default False |
bool Request an iterable reader so data can be consumed in pieces. |
chunksize |
Optional Positional or keyword Default None |
int Set how many rows to read or write in each batch. |
**kwargs |
Optional Additional keyword arguments |
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(pd.read_hdf(path, key="orders", where="units > 2"))