pandas.read_hdf
-
pandas.read_hdf(path_or_buf, key=None, mode='r', **kwargs)
[source] -
Read from the store, close it if we opened it.
Retrieve pandas object stored in file, optionally based on where criteria
Parameters: path_or_buf : string, buffer or path object
Path to the file to open, or an open
pandas.HDFStore
object. Supports any object implementing the__fspath__
protocol. This includespathlib.Path
and py._path.local.LocalPath objects.New in version 0.19.0: support for pathlib, py.path.
New in version 0.21.0: support for __fspath__ proptocol.
key : object, optional
The group identifier in the store. Can be omitted if the HDF file contains a single pandas object.
mode : {‘r’, ‘r+’, ‘a’}, optional
Mode to use when opening the file. Ignored if path_or_buf is a
pandas.HDFStore
. Default is ‘r’.where : list, optional
A list of Term (or convertible) objects.
start : int, optional
Row number to start selection.
stop : int, optional
Row number to stop selection.
columns : list, optional
A list of columns names to return.
iterator : bool, optional
Return an iterator object.
chunksize : int, optional
Number of rows to include in an iteration when using an iterator.
errors : str, default ‘strict’
Specifies how encoding and decoding errors are to be handled. See the errors argument for
open()
for a full list of options.**kwargs
Additional keyword arguments passed to HDFStore.
Returns: item : object
The selected object. Return type depends on the object stored.
See also
-
pandas.DataFrame.to_hdf
- write a HDF file from a DataFrame
-
pandas.HDFStore
- low-level access to HDF files
Examples
>>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z']) >>> df.to_hdf('./store.h5', 'data') >>> reread = pd.read_hdf('./store.h5')
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.23.4/generated/pandas.read_hdf.html