DOC: Improve what's new · pandas-dev/pandas@3f4cd45 (original) (raw)
`` @@ -44,15 +44,22 @@ fixed-width text files, and :func:read_excel
for parsing Excel files.
``
44
44
` pd.read_fwf(StringIO(data)).dtypes
`
45
45
` pd.read_fwf(StringIO(data), dtype={'a':'float64', 'b':'object'}).dtypes
`
46
46
``
47
``
`` -
Reading dataframes from URLs, in :func:read_csv
or :func:read_table
, now
``
48
``
`` -
supports additional compression methods (xz
, bz2
, zip
). Previously, only
``
49
``
`` -
gzip
compression was supported. By default, compression of URLs and paths are
``
50
``
`-
now both inferred using their file extensions.
`
``
47
Better support for compressed URLs in ``read_csv``
``
48
`+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`
51
49
``
52
``
`-
.. ipython:: python
`
``
50
`` +
Compression code was refactored (:issue:12688
). As a result, reading
``
``
51
`` +
dataframes from URLs in :func:read_csv
or :func:read_table
now supports
``
``
52
additional compression methods: ``xz``, ``bz2``, and ``zip`` (:issue:`14570`).
``
53
Previously, only ``gzip`` compression was supported. By default, compression of
``
54
`+
URLs and paths are now both inferred using their file extensions. Additionally,
`
``
55
`` +
bz2 support for the python 2 c-engine improved (:issue:14874
).
``
53
56
``
54
``
`-
url = ('https://github.com/pandas-dev/pandas/raw/master/' +
`
55
``
`-
'pandas/io/tests/parser/data/salaries.csv.bz2')
`
``
57
`+
.. ipython:: python
`
``
58
`+
url = 'https://github.com/{repo}/raw/{branch}/{path}'.format(
`
``
59
`+
repo = 'pandas-dev/pandas',
`
``
60
`+
branch = 'master',
`
``
61
`+
path = 'pandas/io/tests/parser/data/salaries.csv.bz2',
`
``
62
`+
)
`
56
63
` df = pd.read_table(url, compression='infer') # default, infer compression
`
57
64
` df = pd.read_table(url, compression='bz2') # explicitly specify compression
`
58
65
` df.head(2)
`