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
valuecolumn-wise according todand appends each slice to the corresponding table. Theselectortable is the one you query against; its columns are made data_columns so they can be used inwhereclauses.- Parameters:
- ddict
Mapping of table_name to table_columns.
Noneis 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_columnsis passed, in which case those are used.- data_columnslist of str or True, optional
Columns to create as data columns, or
Trueto 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
dropnakeyword is deprecated and will be removed in a future version. UseDataFrame.dropna()before writing instead.- **kwargs
Additional keyword arguments forwarded to
HDFStore.append().
See also
HDFStore.appendAppend to a single table.
HDFStore.select_as_multipleRead 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()