Skip to content

Commit a7960f6

Browse files
committed
DOC: Improve _infer_compression docstring
pandas-dev@4a5aec4#commitcomment-20178761
1 parent 49e3137 commit a7960f6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pandas/io/common.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,26 @@ def file_path_to_url(path):
247247

248248
def _infer_compression(filepath_or_buffer, compression):
249249
"""
250-
Get file handle for given path/buffer and mode.
250+
Get the compression method for filepath_or_buffer. If compression='infer',
251+
the inferred compression method is returned. Otherwise, the input
252+
compression method is returned unchanged, unless it's invalid, in which case
253+
an error is raised.
251254
252255
Parameters
253256
----------
254257
filepath_or_buf :
255258
a path (str) or buffer
256-
compression : str, or None
259+
compression : str or None
260+
the compression method including None for no compression and 'infer'
257261
258262
Returns
259263
-------
260-
string compression method, None
264+
string or None :
265+
compression method
261266
262267
Raises
263268
------
264269
ValueError on invalid compression specified
265-
266-
If compression='infer', infer compression. If compression
267270
"""
268271

269272
# No compression has been explicitly specified

0 commit comments

Comments
 (0)