xorbits.pandas.read_hdf#

xorbits.pandas.read_hdf(path_or_buf: FilePath | HDFStore, key=None, mode: str = 'r', errors: str = 'strict', where: str | list | None = None, start: int | None = None, stop: int | None = None, columns: list[str] | None = None, iterator: bool = False, chunksize: int | None = None, **kwargs)[源代码]#

Read from the store, close it if we opened it.

Retrieve pandas object stored in file, optionally based on where criteria.

警告

Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the “fixed” format. Loading pickled data received from untrusted sources can be unsafe.

See: https://docs.python.org/3/library/pickle.html for more.

参数
  • path_or_buf (str, path object, pandas.HDFStore) –

    Any valid string path is acceptable. Only supports the local file system, remote URLs and file-like objects are not supported.

    If you want to pass in a path object, pandas accepts any os.PathLike.

    Alternatively, pandas accepts an open pandas.HDFStore object.

  • 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'}, default 'r') – Mode to use when opening the file. Ignored if path_or_buf is a pandas.HDFStore. Default is ‘r’.

  • 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.

  • 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.

  • **kwargs – Additional keyword arguments passed to HDFStore.

返回

The selected object. Return type depends on the object stored.

返回类型

object

参见

DataFrame.to_hdf

Write a HDF file from a DataFrame.

HDFStore

Low-level access to HDF files.

实际案例

>>> df = pd.DataFrame([[1, 1.0, 'a']], columns=['x', 'y', 'z'])  
>>> df.to_hdf('./store.h5', 'data')  
>>> reread = pd.read_hdf('./store.h5')  

警告

This method has not been implemented yet. Xorbits will try to execute it with pandas.

This docstring was copied from pandas.