pandas.HDFStore.put#

HDFStore.put(key, value, format=None, index=True, append=False, complib=None, complevel=None, min_itemsize=None, nan_rep=None, data_columns=None, encoding=None, errors='strict', track_times=True, dropna=False)[source]#

Store object in HDFStore.

Parameters:
keystr

Key of object to store in file.

value{Series, DataFrame}

Value of object to store in file.

format‘fixed(f)|table(t)’, default is ‘fixed’

Format to use when storing object in HDFStore. Value can be one of:

'fixed'

Fixed format. Fast writing/reading. Not-appendable, nor searchable.

'table'

Table format. Write as a PyTables Table structure which may perform worse but allow more flexible operations like searching / selecting subsets of the data.

indexbool, default True

Write DataFrame index as a column.

appendbool, default False

This will force Table format, append the input data to the existing.

complibdefault None

This parameter is currently not accepted.

complevelint, 0-9, default None

Specifies a compression level for data. A value of 0 or None disables compression.

min_itemsizeint, dict, or None

Dict of columns that specify minimum str sizes.

nan_repstr

Str to use as str nan representation.

data_columnslist of columns or True, default None

List of columns to create as data columns, or True to use all columns. See here.

encodingstr, default None

Provide an encoding for strings.

errorsstr, default ‘strict’

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

track_timesbool, default True

Parameter is propagated to ‘create_table’ method of ‘PyTables’. If set to False it enables to have the same h5 files (same hashes) independent on creation time.

dropnabool, default False, optional

Remove missing values.

See also

HDFStore.info

Prints detailed information on the store.

HDFStore.get_storer

Returns the storer object for a key.

Examples

>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=["A", "B"])
>>> store = pd.HDFStore("store.h5", "w")  
>>> store.put("data", df)