Skip to content

DOC: fix shared compression_options and decompression_options #47609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3296,7 +3296,7 @@ def to_latex(
@final
@doc(
storage_options=_shared_docs["storage_options"],
compression_options=_shared_docs["compression_options"],
compression_options=_shared_docs["compression_options"] % "path_or_buf",
)
@deprecate_kwarg(old_arg_name="line_terminator", new_arg_name="lineterminator")
def to_csv(
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/shared_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
_shared_docs[
"compression_options"
] = """compression : str or dict, default 'infer'
For on-the-fly compression of the output data. If 'infer' and '%s'
For on-the-fly compression of the output data. If 'infer' and '%s' is
path-like, then detect compression from the following extensions: '.gz',
'.bz2', '.zip', '.xz', '.zst', '.tar', '.tar.gz', '.tar.xz' or '.tar.bz2'
(otherwise no compression).
Expand All @@ -432,7 +432,7 @@
to one of {``'zip'``, ``'gzip'``, ``'bz2'``, ``'zstd'``, ``'tar'``} and other
key-value pairs are forwarded to
``zipfile.ZipFile``, ``gzip.GzipFile``,
``bz2.BZ2File``, ``zstandard.ZstdDecompressor`` or
``bz2.BZ2File``, ``zstandard.ZstdCompressor`` or
``tarfile.TarFile``, respectively.
As an example, the following could be passed for faster compression and to create
a reproducible gzip archive:
Expand Down
6 changes: 4 additions & 2 deletions pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ def read_csv(
summary="Read a comma-separated values (csv) file into DataFrame.",
_default_sep="','",
storage_options=_shared_docs["storage_options"],
decompression_options=_shared_docs["decompression_options"],
decompression_options=_shared_docs["decompression_options"]
% "filepath_or_buffer",
)
)
def read_csv(
Expand Down Expand Up @@ -1189,7 +1190,8 @@ def read_table(
summary="Read general delimited file into DataFrame.",
_default_sep=r"'\\t' (tab-stop)",
storage_options=_shared_docs["storage_options"],
decompression_options=_shared_docs["decompression_options"],
decompression_options=_shared_docs["decompression_options"]
% "filepath_or_buffer",
)
)
def read_table(
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/sas/sasreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def read_sas(


@deprecate_nonkeyword_arguments(version=None, allowed_args=["filepath_or_buffer"])
@doc(decompression_options=_shared_docs["decompression_options"])
@doc(decompression_options=_shared_docs["decompression_options"] % "filepath_or_buffer")
def read_sas(
filepath_or_buffer: FilePath | ReadBuffer[bytes],
format: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
{_statafile_processing_params2}
{_chunksize_params}
{_iterator_params}
{_shared_docs["decompression_options"]}
{_shared_docs["decompression_options"] % "filepath_or_buffer"}
{_shared_docs["storage_options"]}

Returns
Expand Down