@@ -2329,7 +2329,10 @@ def to_excel(
2329
2329
)
2330
2330
2331
2331
@final
2332
- @doc (storage_options = _shared_docs ["storage_options" ])
2332
+ @doc (
2333
+ storage_options = _shared_docs ["storage_options" ],
2334
+ compression_options = _shared_docs ["compression_options" ] % "path_or_buf" ,
2335
+ )
2333
2336
def to_json (
2334
2337
self ,
2335
2338
path_or_buf : FilePath | WriteBuffer [bytes ] | WriteBuffer [str ] | None = None ,
@@ -2406,11 +2409,7 @@ def to_json(
2406
2409
throw ValueError if incorrect 'orient' since others are not
2407
2410
list-like.
2408
2411
2409
- compression : {{'infer', 'gzip', 'bz2', 'zip', 'xz', None}}
2410
-
2411
- A string representing the compression to use in the output file,
2412
- only used when the first argument is a filename. By default, the
2413
- compression is inferred from the filename.
2412
+ {compression_options}
2414
2413
index : bool, default True
2415
2414
Whether to include the index values in the JSON string. Not
2416
2415
including the index (``index=False``) is only supported when
@@ -2918,7 +2917,10 @@ def to_sql(
2918
2917
)
2919
2918
2920
2919
@final
2921
- @doc (storage_options = _shared_docs ["storage_options" ])
2920
+ @doc (
2921
+ storage_options = _shared_docs ["storage_options" ],
2922
+ compression_options = _shared_docs ["compression_options" ] % "path" ,
2923
+ )
2922
2924
def to_pickle (
2923
2925
self ,
2924
2926
path ,
@@ -2933,17 +2935,7 @@ def to_pickle(
2933
2935
----------
2934
2936
path : str
2935
2937
File path where the pickled object will be stored.
2936
- compression : {{'infer', 'gzip', 'bz2', 'zip', 'xz', None}}, \
2937
- default 'infer'
2938
- A string representing the compression to use in the output file. By
2939
- default, infers from the file extension in specified path.
2940
- Compression mode may be any of the following possible
2941
- values: {{‘infer’, ‘gzip’, ‘bz2’, ‘zip’, ‘xz’, None}}. If compression
2942
- mode is ‘infer’ and path_or_buf is path-like, then detect
2943
- compression mode from the following extensions:
2944
- ‘.gz’, ‘.bz2’, ‘.zip’ or ‘.xz’. (otherwise no compression).
2945
- If dict given and mode is ‘zip’ or inferred as ‘zip’, other entries
2946
- passed as additional compression options.
2938
+ {compression_options}
2947
2939
protocol : int
2948
2940
Int which indicates which protocol should be used by the pickler,
2949
2941
default HIGHEST_PROTOCOL (see [1]_ paragraph 12.1.2). The possible
@@ -3337,7 +3329,10 @@ def to_latex(
3337
3329
)
3338
3330
3339
3331
@final
3340
- @doc (storage_options = _shared_docs ["storage_options" ])
3332
+ @doc (
3333
+ storage_options = _shared_docs ["storage_options" ],
3334
+ compression_options = _shared_docs ["compression_options" ],
3335
+ )
3341
3336
def to_csv (
3342
3337
self ,
3343
3338
path_or_buf : FilePath | WriteBuffer [bytes ] | WriteBuffer [str ] | None = None ,
@@ -3403,19 +3398,7 @@ def to_csv(
3403
3398
A string representing the encoding to use in the output file,
3404
3399
defaults to 'utf-8'. `encoding` is not supported if `path_or_buf`
3405
3400
is a non-binary file object.
3406
- compression : str or dict, default 'infer'
3407
- If str, represents compression mode. If dict, value at 'method' is
3408
- the compression mode. Compression mode may be any of the following
3409
- possible values: {{'infer', 'gzip', 'bz2', 'zip', 'xz', None}}. If
3410
- compression mode is 'infer' and `path_or_buf` is path-like, then
3411
- detect compression mode from the following extensions: '.gz',
3412
- '.bz2', '.zip' or '.xz'. (otherwise no compression). If dict given
3413
- and mode is one of {{'zip', 'gzip', 'bz2'}}, or inferred as
3414
- one of the above, other entries passed as
3415
- additional compression options.
3416
- If `path_or_buf` is omitted or `None` or is a file opened in text
3417
- mode, this argument is ignored and an (uncompressed) string is
3418
- returned/written.
3401
+ {compression_options}
3419
3402
3420
3403
.. versionchanged:: 1.0.0
3421
3404
@@ -3426,8 +3409,7 @@ def to_csv(
3426
3409
.. versionchanged:: 1.1.0
3427
3410
3428
3411
Passing compression options as keys in dict is
3429
- supported for compression modes 'gzip' and 'bz2'
3430
- as well as 'zip'.
3412
+ supported for compression modes 'gzip', 'bz2', 'zstd', and 'zip'.
3431
3413
3432
3414
.. versionchanged:: 1.2.0
3433
3415
0 commit comments