pandas.HDFStore.append_to_multiple#

HDFStore.append_to_multiple(d, value, selector, data_columns=None, axes=None, dropna=<no_default>, **kwargs)[source]#

Append to multiple tables.

Splits value column-wise according to d and appends each slice to the corresponding table. The selector table is the one you query against; its columns are made data_columns so they can be used in where clauses.

Parameters:
ddict

Mapping of table_name to table_columns. None is acceptable as the values for one node (that table will get all the remaining columns).

valueDataFrame or Series

Pandas object to split across the tables.

selectorstr

Designates the indexable table; all of its columns will be made data_columns unless data_columns is passed, in which case those are used.

data_columnslist of str or True, optional

Columns to create as data columns, or True to use all columns.

axesdefault None

This parameter is currently not accepted.

dropnabool, default False

If True, drop rows from all tables if any single row in each table has all NaN.

Deprecated since version 3.1.0: The dropna keyword is deprecated and will be removed in a future version. Use DataFrame.dropna() before writing instead.

**kwargs

Additional keyword arguments forwarded to HDFStore.append().

See also

HDFStore.append

Append to a single table.

HDFStore.select_as_multiple

Read from multiple tables with a single where.

Examples

>>> df = pd.DataFrame({"A": [1, 2], "B": [3, 4], "C": [5, 6]})
>>> store = pd.HDFStore("store.h5", "w")
>>> store.append_to_multiple(
...     {"t1": ["A", "B"], "t2": None}, df, selector="t1"
... )
>>> store.close()