Dict-like IO interface for storing pandas objects in PyTables. Either Fixed or Table format. .. warning:: Pandas uses PyTables for reading and writing HDF5 files, which allows serializing object-dtype data with pickle when using the "fixed" format. Loading pickle
| 495 | |
| 496 | @set_module("pandas") |
| 497 | class HDFStore: |
| 498 | """ |
| 499 | Dict-like IO interface for storing pandas objects in PyTables. |
| 500 | |
| 501 | Either Fixed or Table format. |
| 502 | |
| 503 | .. warning:: |
| 504 | |
| 505 | Pandas uses PyTables for reading and writing HDF5 files, which allows |
| 506 | serializing object-dtype data with pickle when using the "fixed" format. |
| 507 | Loading pickled data received from untrusted sources can be unsafe. |
| 508 | |
| 509 | See: https://docs.python.org/3/library/pickle.html for more. |
| 510 | |
| 511 | Parameters |
| 512 | ---------- |
| 513 | path : str |
| 514 | File path to HDF5 file. |
| 515 | mode : {'a', 'w', 'r', 'r+'}, default 'a' |
| 516 | |
| 517 | ``'r'`` |
| 518 | Read-only; no data can be modified. |
| 519 | ``'w'`` |
| 520 | Write; a new file is created (an existing file with the same |
| 521 | name would be deleted). |
| 522 | ``'a'`` |
| 523 | Append; an existing file is opened for reading and writing, |
| 524 | and if the file does not exist it is created. |
| 525 | ``'r+'`` |
| 526 | It is similar to ``'a'``, but the file must already exist. |
| 527 | complevel : int, 0-9, default None |
| 528 | Specifies a compression level for data. |
| 529 | A value of 0 or None disables compression. |
| 530 | complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib' |
| 531 | Specifies the compression library to be used. |
| 532 | These additional compressors for Blosc are supported |
| 533 | (default if no compressor specified: 'blosc:blosclz'): |
| 534 | {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy', |
| 535 | 'blosc:zlib', 'blosc:zstd'}. |
| 536 | Specifying a compression library which is not available issues |
| 537 | a ValueError. |
| 538 | fletcher32 : bool, default False |
| 539 | If applying compression use the fletcher32 checksum. |
| 540 | **kwargs |
| 541 | These parameters will be passed to the PyTables open_file method. |
| 542 | |
| 543 | Examples |
| 544 | -------- |
| 545 | >>> bar = pd.DataFrame(np.random.randn(10, 4)) |
| 546 | >>> store = pd.HDFStore("test.h5") |
| 547 | >>> store["foo"] = bar # write to HDF5 |
| 548 | >>> bar = store["foo"] # retrieve |
| 549 | >>> store.close() |
| 550 | |
| 551 | **Create or load HDF5 file in-memory** |
| 552 | |
| 553 | When passing the `driver` option to the PyTables open_file method through |
| 554 | **kwargs, the HDF5 file is loaded or created in-memory and will only be |
no outgoing calls