@@ -2403,7 +2403,19 @@ def to_json(
2403
2403
indent = indent ,
2404
2404
)
2405
2405
2406
- def to_hdf (self , path_or_buf , key , ** kwargs ):
2406
+ def to_hdf (
2407
+ self ,
2408
+ path_or_buf ,
2409
+ key : str ,
2410
+ mode : str = "a" ,
2411
+ complevel : Optional [int ] = None ,
2412
+ complib : Optional [str ] = None ,
2413
+ append : bool_t = False ,
2414
+ format : Optional [str ] = None ,
2415
+ errors : str = "strict" ,
2416
+ encoding : str = "UTF-8" ,
2417
+ ** kwargs ,
2418
+ ):
2407
2419
"""
2408
2420
Write the contained data to an HDF5 file using HDFStore.
2409
2421
@@ -2431,40 +2443,43 @@ def to_hdf(self, path_or_buf, key, **kwargs):
2431
2443
- 'a': append, an existing file is opened for reading and
2432
2444
writing, and if the file does not exist it is created.
2433
2445
- 'r+': similar to 'a', but the file must already exist.
2434
- format : {'fixed', 'table'}, default 'fixed'
2446
+ complevel : {0-9}, optional
2447
+ Specifies a compression level for data.
2448
+ A value of 0 disables compression.
2449
+ complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib'
2450
+ Specifies the compression library to be used.
2451
+ As of v0.20.2 these additional compressors for Blosc are supported
2452
+ (default if no compressor specified: 'blosc:blosclz'):
2453
+ {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy',
2454
+ 'blosc:zlib', 'blosc:zstd'}.
2455
+ Specifying a compression library which is not available issues
2456
+ a ValueError.
2457
+ append : bool, default False
2458
+ For Table formats, append the input data to the existing.
2459
+ format : {'fixed', 'table', None}, default 'fixed'
2435
2460
Possible values:
2436
2461
2437
2462
- 'fixed': Fixed format. Fast writing/reading. Not-appendable,
2438
2463
nor searchable.
2439
2464
- 'table': Table format. Write as a PyTables Table structure
2440
2465
which may perform worse but allow more flexible operations
2441
2466
like searching / selecting subsets of the data.
2442
- append : bool, default False
2443
- For Table formats, append the input data to the existing.
2467
+ - If None, pd.get_option('io.hdf.default_format') is checked,
2468
+ followed by fallback to "fixed"
2469
+ errors : str, default 'strict'
2470
+ Specifies how encoding and decoding errors are to be handled.
2471
+ See the errors argument for :func:`open` for a full list
2472
+ of options.
2473
+ encoding : str, default "UTF-8"
2444
2474
data_columns : list of columns or True, optional
2445
2475
List of columns to create as indexed data columns for on-disk
2446
2476
queries, or True to use all columns. By default only the axes
2447
2477
of the object are indexed. See :ref:`io.hdf5-query-data-columns`.
2448
2478
Applicable only to format='table'.
2449
- complevel : {0-9}, optional
2450
- Specifies a compression level for data.
2451
- A value of 0 disables compression.
2452
- complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib'
2453
- Specifies the compression library to be used.
2454
- As of v0.20.2 these additional compressors for Blosc are supported
2455
- (default if no compressor specified: 'blosc:blosclz'):
2456
- {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy',
2457
- 'blosc:zlib', 'blosc:zstd'}.
2458
- Specifying a compression library which is not available issues
2459
- a ValueError.
2460
2479
fletcher32 : bool, default False
2461
2480
If applying compression use the fletcher32 checksum.
2462
2481
dropna : bool, default False
2463
2482
If true, ALL nan rows will not be written to store.
2464
- errors : str, default 'strict'
2465
- Specifies how encoding and decoding errors are to be handled.
2466
- See the errors argument for :func:`open` for a full list
2467
- of options.
2468
2483
2469
2484
See Also
2470
2485
--------
@@ -2506,7 +2521,19 @@ def to_hdf(self, path_or_buf, key, **kwargs):
2506
2521
"""
2507
2522
from pandas .io import pytables
2508
2523
2509
- pytables .to_hdf (path_or_buf , key , self , ** kwargs )
2524
+ pytables .to_hdf (
2525
+ path_or_buf ,
2526
+ key ,
2527
+ self ,
2528
+ mode = mode ,
2529
+ complevel = complevel ,
2530
+ complib = complib ,
2531
+ append = append ,
2532
+ format = format ,
2533
+ errors = errors ,
2534
+ encoding = encoding ,
2535
+ ** kwargs ,
2536
+ )
2510
2537
2511
2538
def to_msgpack (self , path_or_buf = None , encoding = "utf-8" , ** kwargs ):
2512
2539
"""
0 commit comments