@@ -64,15 +64,24 @@ Strings passed to ``DataFrame.groupby()`` as the ``by`` parameter may now refere
64
64
65
65
df.groupby(['second', 'A']).sum()
66
66
67
- Reading dataframes from URLs, in :func:`read_csv` or :func:`read_table`, now
68
- supports additional compression methods (`xz`, `bz2`, `zip`). Previously, only
69
- `gzip` compression was supported. By default, compression of URLs and paths are
70
- now both inferred using their file extensions.
67
+ .. _whatsnew_0200.enhancements.compressed_urls:
71
68
72
- .. ipython:: python
69
+ Better support for compressed URLs in ``read_csv``
70
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71
+
72
+ Compression code was refactored (:issue:`12688`). As a result, reading
73
+ dataframes from URLs in :func:`read_csv` or :func:`read_table` now supports
74
+ additional compression methods: ``xz``, ``bz2``, and ``zip`` (:issue:`14570`).
75
+ Previously, only ``gzip`` compression was supported. By default, compression of
76
+ URLs and paths are now both inferred using their file extensions. Additionally,
77
+ bz2 support for the python 2 c-engine improved (:issue:`14874`).
73
78
74
- url = ('https://github.com/pandas-dev/pandas/raw/master/' +
75
- 'pandas/io/tests/parser/data/salaries.csv.bz2')
79
+ .. ipython:: python
80
+ url = 'https://github.com/{repo}/raw/{branch}/{path}'.format(
81
+ repo = 'pandas-dev/pandas',
82
+ branch = 'master',
83
+ path = 'pandas/io/tests/parser/data/salaries.csv.bz2',
84
+ )
76
85
df = pd.read_table(url, compression='infer') # default, infer compression
77
86
df = pd.read_table(url, compression='bz2') # explicitly specify compression
78
87
df.head(2)
0 commit comments