Read from the store, close it if we opened it. Retrieve pandas object stored in file, optionally based on where criteria. .. warning:: Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the "fix
(
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,
)
| 318 | |
| 319 | @set_module("pandas") |
| 320 | def read_hdf( |
| 321 | path_or_buf: FilePath | HDFStore, |
| 322 | key=None, |
| 323 | mode: str = "r", |
| 324 | errors: str = "strict", |
| 325 | where: str | list | None = None, |
| 326 | start: int | None = None, |
| 327 | stop: int | None = None, |
| 328 | columns: list[str] | None = None, |
| 329 | iterator: bool = False, |
| 330 | chunksize: int | None = None, |
| 331 | **kwargs, |
| 332 | ): |
| 333 | """ |
| 334 | Read from the store, close it if we opened it. |
| 335 | |
| 336 | Retrieve pandas object stored in file, optionally based on where |
| 337 | criteria. |
| 338 | |
| 339 | .. warning:: |
| 340 | |
| 341 | Pandas uses PyTables for reading and writing HDF5 files, which allows |
| 342 | serializing object-dtype data with pickle when using the "fixed" format. |
| 343 | Loading pickled data received from untrusted sources can be unsafe. |
| 344 | |
| 345 | See: https://docs.python.org/3/library/pickle.html for more. |
| 346 | |
| 347 | Parameters |
| 348 | ---------- |
| 349 | path_or_buf : str, path object, pandas.HDFStore |
| 350 | Any valid string path is acceptable. Only supports the local file system, |
| 351 | remote URLs and file-like objects are not supported. |
| 352 | |
| 353 | If you want to pass in a path object, pandas accepts any |
| 354 | ``os.PathLike``. |
| 355 | |
| 356 | Alternatively, pandas accepts an open :class:`pandas.HDFStore` object. |
| 357 | |
| 358 | key : object, optional |
| 359 | The group identifier in the store. Can be omitted if the HDF file |
| 360 | contains a single pandas object. |
| 361 | mode : {'r', 'r+', 'a'}, default 'r' |
| 362 | Mode to use when opening the file. Ignored if path_or_buf is a |
| 363 | :class:`pandas.HDFStore`. Default is 'r'. |
| 364 | errors : str, default 'strict' |
| 365 | Specifies how encoding and decoding errors are to be handled. |
| 366 | See the errors argument for :func:`open` for a full list |
| 367 | of options. |
| 368 | where : list, optional |
| 369 | A list of Term (or convertible) objects. |
| 370 | start : int, optional |
| 371 | Row number to start selection. |
| 372 | stop : int, optional |
| 373 | Row number to stop selection. |
| 374 | columns : list, optional |
| 375 | A list of columns names to return. |
| 376 | iterator : bool, optional |
| 377 | Return an iterator object. |