pandas.HDFStore.remove#

HDFStore.remove(key, where=None, start=None, stop=None)[source]#

Remove pandas object partially by specifying the where condition.

If where is not provided, the entire object stored at key (and any of its child nodes) is removed. When where is given, only matching rows are deleted, which requires the object to be in table format.

Parameters:
keystr

Node to remove or delete rows from.

wherelist of Term (or convertible) objects, optional

Conditions selecting which rows to remove.

startint, optional

Row number to start selection.

stopint, optional

Row number to stop selection.

Returns:
int or None

Number of rows removed (or None if the object is not a Table).

Raises:
KeyError

If key is not a valid store.

See also

HDFStore.append

Append data to an existing table.

HDFStore.put

Store an object in the file.

Examples

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