pandas.HDFStore.append

pandas 3.1.1 · Input and output · method

Add rows to an HDFStore table without replacing existing rows.

Call syntax

HDFStore.append(…) Full signature
HDFStore.append(
    key,
    value,
    format=None,
    axes=None,
    index=True,
    append=True,
    complib=None,
    complevel=None,
    columns=None,
    min_itemsize=None,
    nan_rep=None,
    chunksize=None,
    expectedrows=None,
    dropna=…,
    data_columns=None,
    encoding=None,
    errors='strict',
)

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.

value Required
Positional or keyword
{Series, DataFrame}

Provide the value used for the documented operation, such as a replacement or a test point.

format Optional
Positional or keyword
Default None
'table' is the default

Supply a format string or choose an output layout supported by this API.

axes Optional
Positional or keyword
Default None
list
index Optional
Positional or keyword
Default True
bool

Supply row labels or control how existing row labels are used.

append Optional
Positional or keyword
Default True
bool

Add records or keys to existing output instead of replacing it where supported.

complib Optional
Positional or keyword
Default None
{'zlib', 'lzo', 'bzip2', 'blosc'}
complevel Optional
Positional or keyword
Default None
int, 0-9
columns Optional
Positional or keyword
Default None
default None

Supply column labels or control how columns are handled.

min_itemsize Optional
Positional or keyword
Default None
int, dict, or None
nan_rep Optional
Positional or keyword
Default None
str
chunksize Optional
Positional or keyword
Default None
int

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

expectedrows Optional
Positional or keyword
Default None
int
dropna Optional
Positional or keyword
bool

Choose whether to drop missing values or missing keys from consideration.

data_columns Optional
Positional or keyword
Default None
list of columns, or True
encoding Optional
Positional or keyword
Default None
default None

Name a text encoding such as "utf-8".

errors Optional
Positional or keyword
Default 'strict'
str

Choose how to handle invalid input or failed operations. The available options depend on the API.

Returns

None

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"])
        store.append("orders", pd.DataFrame({"units": [7], "price": [2]}))
        print(store["orders"])