diff --git a/pandas/io/formats/csvs.py b/pandas/io/formats/csvs.py index 3c236fa10a5d6..6fabd2573a7b4 100644 --- a/pandas/io/formats/csvs.py +++ b/pandas/io/formats/csvs.py @@ -134,7 +134,7 @@ def save(self): """ Create the writer & save """ - # GH 21227 internal compression is not used when file-like passed. + # GH21227 internal compression is not used when file-like passed. if self.compression and hasattr(self.path_or_buf, 'write'): msg = ("compression has no effect when passing file-like " "object as input.") @@ -148,7 +148,7 @@ def save(self): if is_zip: # zipfile doesn't support writing string to archive. uses string # buffer to receive csv writing and dump into zip compression - # file handle. GH 21241, 21118 + # file handle. GH21241, GH21118 f = StringIO() close = False elif hasattr(self.path_or_buf, 'write'): @@ -176,7 +176,7 @@ def save(self): finally: if is_zip: - # GH 17778 handles zip compression separately. + # GH17778 handles zip compression separately. buf = f.getvalue() if hasattr(self.path_or_buf, 'write'): self.path_or_buf.write(buf) diff --git a/pandas/tests/io/test_compression.py b/pandas/tests/io/test_compression.py index a3639b3e236df..76788ced44e84 100644 --- a/pandas/tests/io/test_compression.py +++ b/pandas/tests/io/test_compression.py @@ -53,8 +53,7 @@ def test_compression_size_fh(obj, method, compression_only): ]) def test_dataframe_compression_defaults_to_infer( write_method, write_kwargs, read_method, compression_only): - # Test that DataFrame.to_* methods default to inferring compression from - # paths. GH 22004 + # GH22004 input = pd.DataFrame([[1.0, 0, -4], [3.4, 5, 2]], columns=['X', 'Y', 'Z']) extension = icom._compression_to_extension[compression_only] with tm.ensure_clean('compressed' + extension) as path: @@ -72,8 +71,7 @@ def test_dataframe_compression_defaults_to_infer( def test_series_compression_defaults_to_infer( write_method, write_kwargs, read_method, read_kwargs, compression_only): - # Test that Series.to_* methods default to inferring compression from - # paths. GH 22004 + # GH22004 input = pd.Series([0, 5, -2, 10], name='X') extension = icom._compression_to_extension[compression_only] with tm.ensure_clean('compressed' + extension) as path: @@ -84,7 +82,7 @@ def test_series_compression_defaults_to_infer( def test_compression_warning(compression_only): # Assert that passing a file object to to_csv while explicitly specifying a - # compression protocol triggers a RuntimeWarning, as per GH 21227. + # compression protocol triggers a RuntimeWarning, as per GH21227. # Note that pytest has an issue that causes assert_produces_warning to fail # in Python 2 if the warning has occurred in previous tests # (see https://git.io/fNEBm & https://git.io/fNEBC). Hence, should this