You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.24.0.rst
+62-54
Original file line number
Diff line number
Diff line change
@@ -10,27 +10,34 @@ What's New in 0.24.0 (January XX, 2019)
10
10
11
11
{{ header }}
12
12
13
-
These are the changes in pandas 0.24.0. See :ref:`release` for a full changelog
14
-
including other versions of pandas.
13
+
This is a major release from 0.23.4 and includes a number of API changes, new
14
+
features, enhancements, and performance improvements along with a large number
15
+
of bug fixes.
15
16
16
-
Enhancements
17
-
~~~~~~~~~~~~
17
+
Highlights include:
18
18
19
-
Highlights include
20
-
21
-
* :ref:`Optional Nullable Integer Support <whatsnew_0240.enhancements.intna>`
19
+
* :ref:`Optional Integer NA Support <whatsnew_0240.enhancements.intna>`
22
20
* :ref:`New APIs for accessing the array backing a Series or Index <whatsnew_0240.values_api>`
23
21
* :ref:`A new top-level method for creating arrays <whatsnew_0240.enhancements.array>`
24
22
* :ref:`Store Interval and Period data in a Series or DataFrame <whatsnew_0240.enhancements.interval>`
25
23
* :ref:`Support for joining on two MultiIndexes <whatsnew_0240.enhancements.join_with_two_multiindexes>`
26
24
25
+
26
+
Check the :ref:`API Changes <whatsnew_0240.api_breaking>` and :ref:`deprecations <whatsnew_0240.deprecations>` before updating.
27
+
28
+
These are the changes in pandas 0.24.0. See :ref:`release` for a full changelog
29
+
including other versions of pandas.
30
+
31
+
32
+
Enhancements
33
+
~~~~~~~~~~~~
34
+
27
35
.. _whatsnew_0240.enhancements.intna:
28
36
29
37
Optional Integer NA Support
30
38
^^^^^^^^^^^^^^^^^^^^^^^^^^^
31
39
32
40
Pandas has gained the ability to hold integer dtypes with missing values. This long requested feature is enabled through the use of :ref:`extension types <extending.extension-types>`.
33
-
Here is an example of the usage.
34
41
35
42
.. note::
36
43
@@ -65,7 +72,7 @@ Operations on these dtypes will propagate ``NaN`` as other pandas operations.
65
72
# coerce when needed
66
73
s +0.01
67
74
68
-
These dtypes can operate as part of of ``DataFrame``.
75
+
These dtypes can operate as part of a ``DataFrame``.
69
76
70
77
.. ipython:: python
71
78
@@ -74,7 +81,7 @@ These dtypes can operate as part of of ``DataFrame``.
74
81
df.dtypes
75
82
76
83
77
-
These dtypes can be merged & reshaped & casted.
84
+
These dtypes can be merged, reshaped, and casted.
78
85
79
86
.. ipython:: python
80
87
@@ -117,6 +124,7 @@ a new ndarray of period objects each time.
117
124
118
125
.. ipython:: python
119
126
127
+
idx.values
120
128
id(idx.values)
121
129
id(idx.values)
122
130
@@ -129,7 +137,7 @@ If you need an actual NumPy array, use :meth:`Series.to_numpy` or :meth:`Index.t
129
137
130
138
For Series and Indexes backed by normal NumPy arrays, :attr:`Series.array` will return a
131
139
new :class:`arrays.PandasArray`, which is a thin (no-copy) wrapper around a
132
-
:class:`numpy.ndarray`. :class:`arrays.PandasArray` isn't especially useful on its own,
140
+
:class:`numpy.ndarray`. :class:`~arrays.PandasArray` isn't especially useful on its own,
133
141
but it does provide the same interface as any extension array defined in pandas or by
134
142
a third-party library.
135
143
@@ -147,14 +155,13 @@ See :ref:`Dtypes <basics.dtypes>` and :ref:`Attributes and Underlying Data <basi
147
155
148
156
.. _whatsnew_0240.enhancements.array:
149
157
150
-
Array
151
-
^^^^^
158
+
``pandas.array``: a new top-level method for creating arrays
A ``Series`` based on an ``ExtensionArray`` now supports arithmetic and comparison
277
-
operators (:issue:`19577`). There are two approaches for providing operator support for an ``ExtensionArray``:
278
-
279
-
1. Define each of the operators on your ``ExtensionArray`` subclass.
280
-
2. Use an operator implementation from pandas that depends on operators that are already defined
281
-
on the underlying elements (scalars) of the ``ExtensionArray``.
282
-
283
-
See the :ref:`ExtensionArray Operator Support
284
-
<extending.extension.operator>` documentation section for details on both
285
-
ways of adding operator support.
286
-
287
277
.. _whatsnew_0240.enhancements.read_html:
288
278
289
279
``read_html`` Enhancements
@@ -343,15 +333,15 @@ convenient way to apply users' predefined styling functions, and can help reduce
343
333
df.style.pipe(format_and_align).set_caption('Summary of results.')
344
334
345
335
Similar methods already exist for other classes in pandas, including :meth:`DataFrame.pipe`,
346
-
:meth:`pandas.core.groupby.GroupBy.pipe`, and :meth:`pandas.core.resample.Resampler.pipe`.
336
+
:meth:`GroupBy.pipe() <pandas.core.groupby.GroupBy.pipe>`, and :meth:`Resampler.pipe() <pandas.core.resample.Resampler.pipe>`.
347
337
348
338
.. _whatsnew_0240.enhancements.rename_axis:
349
339
350
340
Renaming names in a MultiIndex
351
341
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
352
342
353
343
:func:`DataFrame.rename_axis` now supports ``index`` and ``columns`` arguments
354
-
and :func:`Series.rename_axis` supports ``index`` argument (:issue:`19978`)
344
+
and :func:`Series.rename_axis` supports ``index`` argument (:issue:`19978`).
355
345
356
346
This change allows a dictionary to be passed so that some of the names
357
347
of a ``MultiIndex`` can be changed.
@@ -379,13 +369,13 @@ Other Enhancements
379
369
- :func:`DataFrame.to_parquet` now accepts ``index`` as an argument, allowing
380
370
the user to override the engine's default behavior to include or omit the
381
371
dataframe's indexes from the resulting Parquet file. (:issue:`20768`)
372
+
- :func:`read_feather` now accepts ``columns`` as an argument, allowing the user to specify which columns should be read. (:issue:`24025`)
382
373
- :meth:`DataFrame.corr` and :meth:`Series.corr` now accept a callable for generic calculation methods of correlation, e.g. histogram intersection (:issue:`22684`)
383
374
- :func:`DataFrame.to_string` now accepts ``decimal`` as an argument, allowing the user to specify which decimal separator should be used in the output. (:issue:`23614`)
384
-
- :func:`read_feather` now accepts ``columns`` as an argument, allowing the user to specify which columns should be read. (:issue:`24025`)
385
375
- :func:`DataFrame.to_html` now accepts ``render_links`` as an argument, allowing the user to generate HTML with links to any URLs that appear in the DataFrame.
386
376
See the :ref:`section on writing HTML <io.html>` in the IO docs for example usage. (:issue:`2679`)
387
377
- :func:`pandas.read_csv` now supports pandas extension types as an argument to ``dtype``, allowing the user to use pandas extension types when reading CSVs. (:issue:`23228`)
388
-
- :meth:`DataFrame.shift` :meth:`Series.shift`, :meth:`ExtensionArray.shift`, :meth:`SparseArray.shift`, :meth:`Period.shift`, :meth:`GroupBy.shift`, :meth:`Categorical.shift`, :meth:`NDFrame.shift` and :meth:`Block.shift` now accept `fill_value` as an argument, allowing the user to specify a value which will be used instead of NA/NaT in the empty periods. (:issue:`15486`)
378
+
- The :meth:`~DataFrame.shift` method now accepts `fill_value` as an argument, allowing the user to specify a value which will be used instead of NA/NaT in the empty periods. (:issue:`15486`)
389
379
- :func:`to_datetime` now supports the ``%Z`` and ``%z`` directive when passed into ``format`` (:issue:`13486`)
390
380
- :func:`Series.mode` and :func:`DataFrame.mode` now support the ``dropna`` parameter which can be used to specify whether ``NaN``/``NaT`` values should be considered (:issue:`17534`)
391
381
- :func:`DataFrame.to_csv` and :func:`Series.to_csv` now support the ``compression`` keyword when a file handle is passed. (:issue:`21227`)
@@ -407,18 +397,19 @@ Other Enhancements
407
397
The default compression for ``to_csv``, ``to_json``, and ``to_pickle`` methods has been updated to ``'infer'`` (:issue:`22004`).
408
398
- :meth:`DataFrame.to_sql` now supports writing ``TIMESTAMP WITH TIME ZONE`` types for supported databases. For databases that don't support timezones, datetime data will be stored as timezone unaware local timestamps. See the :ref:`io.sql_datetime_data` for implications (:issue:`9086`).
409
399
- :func:`to_timedelta` now supports iso-formated timedelta strings (:issue:`21877`)
410
-
- :class:`Series` and :class:`DataFrame` now support :class:`Iterable` in constructor (:issue:`2193`)
400
+
- :class:`Series` and :class:`DataFrame` now support :class:`Iterable` objects in the constructor (:issue:`2193`)
411
401
- :class:`DatetimeIndex` has gained the :attr:`DatetimeIndex.timetz` attribute. This returns the local time with timezone information. (:issue:`21358`)
412
-
- :meth:`Timestamp.round`, :meth:`Timestamp.ceil`, and :meth:`Timestamp.floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support an ``ambiguous`` argument for handling datetimes that are rounded to ambiguous times (:issue:`18946`)
413
-
- :meth:`Timestamp.round`, :meth:`Timestamp.ceil`, and :meth:`Timestamp.floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support a ``nonexistent`` argument for handling datetimes that are rounded to nonexistent times. See :ref:`timeseries.timezone_nonexistent` (:issue:`22647`)
414
-
- :class:`pandas.core.resample.Resampler` now is iterable like :class:`pandas.core.groupby.GroupBy` (:issue:`15314`).
402
+
- :meth:`~Timestamp.round`, :meth:`~Timestamp.ceil`, and :meth:`~Timestamp.floor` for :class:`DatetimeIndex` and :class:`Timestamp`
403
+
now support an ``ambiguous`` argument for handling datetimes that are rounded to ambiguous times (:issue:`18946`)
404
+
and a ``nonexistent`` argument for handling datetimes that are rounded to nonexistent times. See :ref:`timeseries.timezone_nonexistent` (:issue:`22647`)
405
+
- The result of :meth:`~DataFrame.resample` is now iterable similar to ``groupby()`` (:issue:`15314`).
415
406
- :meth:`Series.resample` and :meth:`DataFrame.resample` have gained the :meth:`pandas.core.resample.Resampler.quantile` (:issue:`15023`).
416
407
- :meth:`DataFrame.resample` and :meth:`Series.resample` with a :class:`PeriodIndex` will now respect the ``base`` argument in the same fashion as with a :class:`DatetimeIndex`. (:issue:`23882`)
417
408
- :meth:`pandas.api.types.is_list_like` has gained a keyword ``allow_sets`` which is ``True`` by default; if ``False``,
418
409
all instances of ``set`` will not be considered "list-like" anymore (:issue:`23061`)
419
410
- :meth:`Index.to_frame` now supports overriding column name(s) (:issue:`22580`).
420
411
- :meth:`Categorical.from_codes` now can take a ``dtype`` parameter as an alternative to passing ``categories`` and ``ordered`` (:issue:`24398`).
421
-
- New attribute :attr:`__git_version__` will return git commit sha of current build (:issue:`21295`).
412
+
- New attribute ``__git_version__`` will return git commit sha of current build (:issue:`21295`).
422
413
- Compatibility with Matplotlib 3.0 (:issue:`22790`).
423
414
- Added :meth:`Interval.overlaps`, :meth:`IntervalArray.overlaps`, and :meth:`IntervalIndex.overlaps` for determining overlaps between interval-like objects (:issue:`21998`)
424
415
- :func:`read_fwf` now accepts keyword ``infer_nrows`` (:issue:`15138`).
@@ -433,7 +424,7 @@ Other Enhancements
433
424
- :class:`IntervalIndex` has gained the :attr:`~IntervalIndex.is_overlapping` attribute to indicate if the ``IntervalIndex`` contains any overlapping intervals (:issue:`23309`)
434
425
- :func:`pandas.DataFrame.to_sql` has gained the ``method`` argument to control SQL insertion clause. See the :ref:`insertion method <io.sql.method>` section in the documentation. (:issue:`8953`)
435
426
- :meth:`DataFrame.corrwith` now supports Spearman's rank correlation, Kendall's tau as well as callable correlation methods. (:issue:`21925`)
436
-
- :meth:`DataFrame.to_json`, :meth:`DataFrame.to_csv`, :meth:`DataFrame.to_pickle`, and :meth:`DataFrame.to_XXX` etc. now support tilde(~) in path argument. (:issue:`23473`)
427
+
- :meth:`DataFrame.to_json`, :meth:`DataFrame.to_csv`, :meth:`DataFrame.to_pickle`, and other export methods now support tilde(~) in path argument. (:issue:`23473`)
437
428
438
429
.. _whatsnew_0240.api_breaking:
439
430
@@ -445,8 +436,8 @@ Pandas 0.24.0 includes a number of API breaking changes.
445
436
446
437
.. _whatsnew_0240.api_breaking.deps:
447
438
448
-
Dependencies have increased minimum versions
449
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
439
+
Increased minimum versions for dependencies
440
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
450
441
451
442
We have updated our minimum supported versions of dependencies (:issue:`21242`, :issue:`18742`, :issue:`23774`, :issue:`24767`).
452
443
If installed, we now require:
@@ -1174,17 +1165,19 @@ Other API Changes
1174
1165
1175
1166
.. _whatsnew_0240.api.extension:
1176
1167
1177
-
ExtensionType Changes
1178
-
~~~~~~~~~~~~~~~~~~~~~
1168
+
Extension Type Changes
1169
+
~~~~~~~~~~~~~~~~~~~~~~
1179
1170
1180
1171
**Equality and Hashability**
1181
1172
1182
-
Pandas now requires that extension dtypes be hashable. The base class implements
1173
+
Pandas now requires that extension dtypes be hashable (i.e. the respective
1174
+
``ExtensionDtype`` objects; hashability is not a requirement for the values
1175
+
of the corresponding ``ExtensionArray``). The base class implements
1183
1176
a default ``__eq__`` and ``__hash__``. If you have a parametrized dtype, you should
1184
1177
update the ``ExtensionDtype._metadata`` tuple to match the signature of your
1185
1178
``__init__`` method. See :class:`pandas.api.extensions.ExtensionDtype` for more (:issue:`22476`).
1186
1179
1187
-
**Reshaping changes**
1180
+
**New and changed methods**
1188
1181
1189
1182
- :meth:`~pandas.api.types.ExtensionArray.dropna` has been added (:issue:`21185`)
1190
1183
- :meth:`~pandas.api.types.ExtensionArray.repeat` has been added (:issue:`24349`)
@@ -1202,9 +1195,25 @@ update the ``ExtensionDtype._metadata`` tuple to match the signature of your
1202
1195
- Added :meth:`pandas.api.types.register_extension_dtype` to register an extension type with pandas (:issue:`22664`)
1203
1196
- Updated the ``.type`` attribute for ``PeriodDtype``, ``DatetimeTZDtype``, and ``IntervalDtype`` to be instances of the dtype (``Period``, ``Timestamp``, and ``Interval`` respectively) (:issue:`22938`)
A ``Series`` based on an ``ExtensionArray`` now supports arithmetic and comparison
1203
+
operators (:issue:`19577`). There are two approaches for providing operator support for an ``ExtensionArray``:
1204
+
1205
+
1. Define each of the operators on your ``ExtensionArray`` subclass.
1206
+
2. Use an operator implementation from pandas that depends on operators that are already defined
1207
+
on the underlying elements (scalars) of the ``ExtensionArray``.
1208
+
1209
+
See the :ref:`ExtensionArray Operator Support
1210
+
<extending.extension.operator>` documentation section for details on both
1211
+
ways of adding operator support.
1212
+
1205
1213
**Other changes**
1206
1214
1207
1215
- A default repr for :class:`pandas.api.extensions.ExtensionArray` is now provided (:issue:`23601`).
1216
+
- :meth:`ExtensionArray._formatting_values` is deprecated. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`)
1208
1217
- An ``ExtensionArray`` with a boolean dtype now works correctly as a boolean indexer. :meth:`pandas.api.types.is_bool_dtype` now properly considers them boolean (:issue:`22326`)
1209
1218
1210
1219
**Bug Fixes**
@@ -1253,7 +1262,6 @@ Deprecations
1253
1262
- The methods :meth:`DataFrame.update` and :meth:`Panel.update` have deprecated the ``raise_conflict=False|True`` keyword in favor of ``errors='ignore'|'raise'`` (:issue:`23585`)
1254
1263
- The methods :meth:`Series.str.partition` and :meth:`Series.str.rpartition` have deprecated the ``pat`` keyword in favor of ``sep`` (:issue:`22676`)
1255
1264
- Deprecated the ``nthreads`` keyword of :func:`pandas.read_feather` in favor of ``use_threads`` to reflect the changes in ``pyarrow>=0.11.0``. (:issue:`23053`)
1256
-
- :meth:`ExtensionArray._formatting_values` is deprecated. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`)
1257
1265
- :func:`pandas.read_excel` has deprecated accepting ``usecols`` as an integer. Please pass in a list of ints from 0 to ``usecols`` inclusive instead (:issue:`23527`)
1258
1266
- Constructing a :class:`TimedeltaIndex` from data with ``datetime64``-dtyped data is deprecated, will raise ``TypeError`` in a future version (:issue:`23539`)
1259
1267
- Constructing a :class:`DatetimeIndex` from data with ``timedelta64``-dtyped data is deprecated, will raise ``TypeError`` in a future version (:issue:`23675`)
0 commit comments