Skip to content

Commit d82829c

Browse files
jorisvandenbosschePingviinituutti
authored andcommitted
DOC: some 0.24.0 whatsnew clean-up (pandas-dev#24911)
1 parent 91e7d22 commit d82829c

File tree

1 file changed

+62
-54
lines changed

1 file changed

+62
-54
lines changed

doc/source/whatsnew/v0.24.0.rst

+62-54
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,34 @@ What's New in 0.24.0 (January XX, 2019)
1010

1111
{{ header }}
1212

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.
1516

16-
Enhancements
17-
~~~~~~~~~~~~
17+
Highlights include:
1818

19-
Highlights include
20-
21-
* :ref:`Optional Nullable Integer Support <whatsnew_0240.enhancements.intna>`
19+
* :ref:`Optional Integer NA Support <whatsnew_0240.enhancements.intna>`
2220
* :ref:`New APIs for accessing the array backing a Series or Index <whatsnew_0240.values_api>`
2321
* :ref:`A new top-level method for creating arrays <whatsnew_0240.enhancements.array>`
2422
* :ref:`Store Interval and Period data in a Series or DataFrame <whatsnew_0240.enhancements.interval>`
2523
* :ref:`Support for joining on two MultiIndexes <whatsnew_0240.enhancements.join_with_two_multiindexes>`
2624

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+
2735
.. _whatsnew_0240.enhancements.intna:
2836

2937
Optional Integer NA Support
3038
^^^^^^^^^^^^^^^^^^^^^^^^^^^
3139

3240
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.
3441

3542
.. note::
3643

@@ -65,7 +72,7 @@ Operations on these dtypes will propagate ``NaN`` as other pandas operations.
6572
# coerce when needed
6673
s + 0.01
6774
68-
These dtypes can operate as part of of ``DataFrame``.
75+
These dtypes can operate as part of a ``DataFrame``.
6976

7077
.. ipython:: python
7178
@@ -74,7 +81,7 @@ These dtypes can operate as part of of ``DataFrame``.
7481
df.dtypes
7582
7683
77-
These dtypes can be merged & reshaped & casted.
84+
These dtypes can be merged, reshaped, and casted.
7885

7986
.. ipython:: python
8087
@@ -117,6 +124,7 @@ a new ndarray of period objects each time.
117124

118125
.. ipython:: python
119126
127+
idx.values
120128
id(idx.values)
121129
id(idx.values)
122130
@@ -129,7 +137,7 @@ If you need an actual NumPy array, use :meth:`Series.to_numpy` or :meth:`Index.t
129137
130138
For Series and Indexes backed by normal NumPy arrays, :attr:`Series.array` will return a
131139
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,
133141
but it does provide the same interface as any extension array defined in pandas or by
134142
a third-party library.
135143

@@ -147,14 +155,13 @@ See :ref:`Dtypes <basics.dtypes>` and :ref:`Attributes and Underlying Data <basi
147155

148156
.. _whatsnew_0240.enhancements.array:
149157

150-
Array
151-
^^^^^
158+
``pandas.array``: a new top-level method for creating arrays
159+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152160

153161
A new top-level method :func:`array` has been added for creating 1-dimensional arrays (:issue:`22860`).
154162
This can be used to create any :ref:`extension array <extending.extension-types>`, including
155-
extension arrays registered by :ref:`3rd party libraries <ecosystem.extensions>`. See
156-
157-
See :ref:`Dtypes <basics.dtypes>` for more on extension arrays.
163+
extension arrays registered by :ref:`3rd party libraries <ecosystem.extensions>`.
164+
See the :ref:`dtypes docs <basics.dtypes>` for more on extension arrays.
158165

159166
.. ipython:: python
160167
@@ -163,15 +170,15 @@ See :ref:`Dtypes <basics.dtypes>` for more on extension arrays.
163170
164171
Passing data for which there isn't dedicated extension type (e.g. float, integer, etc.)
165172
will return a new :class:`arrays.PandasArray`, which is just a thin (no-copy)
166-
wrapper around a :class:`numpy.ndarray` that satisfies the extension array interface.
173+
wrapper around a :class:`numpy.ndarray` that satisfies the pandas extension array interface.
167174

168175
.. ipython:: python
169176
170177
pd.array([1, 2, 3])
171178
172-
On their own, a :class:`arrays.PandasArray` isn't a very useful object.
179+
On their own, a :class:`~arrays.PandasArray` isn't a very useful object.
173180
But if you need write low-level code that works generically for any
174-
:class:`~pandas.api.extensions.ExtensionArray`, :class:`arrays.PandasArray`
181+
:class:`~pandas.api.extensions.ExtensionArray`, :class:`~arrays.PandasArray`
175182
satisfies that need.
176183

177184
Notice that by default, if no ``dtype`` is specified, the dtype of the returned
@@ -202,7 +209,7 @@ For periods:
202209

203210
.. ipython:: python
204211
205-
pser = pd.Series(pd.date_range("2000", freq="D", periods=5))
212+
pser = pd.Series(pd.period_range("2000", freq="D", periods=5))
206213
pser
207214
pser.dtype
208215
@@ -267,23 +274,6 @@ For earlier versions this can be done using the following.
267274
pd.merge(left.reset_index(), right.reset_index(),
268275
on=['key'], how='inner').set_index(['key', 'X', 'Y'])
269276
270-
271-
.. _whatsnew_0240.enhancements.extension_array_operators:
272-
273-
``ExtensionArray`` operator support
274-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
275-
276-
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-
287277
.. _whatsnew_0240.enhancements.read_html:
288278

289279
``read_html`` Enhancements
@@ -343,15 +333,15 @@ convenient way to apply users' predefined styling functions, and can help reduce
343333
df.style.pipe(format_and_align).set_caption('Summary of results.')
344334
345335
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>`.
347337

348338
.. _whatsnew_0240.enhancements.rename_axis:
349339

350340
Renaming names in a MultiIndex
351341
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
352342

353343
: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`).
355345

356346
This change allows a dictionary to be passed so that some of the names
357347
of a ``MultiIndex`` can be changed.
@@ -379,13 +369,13 @@ Other Enhancements
379369
- :func:`DataFrame.to_parquet` now accepts ``index`` as an argument, allowing
380370
the user to override the engine's default behavior to include or omit the
381371
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`)
382373
- :meth:`DataFrame.corr` and :meth:`Series.corr` now accept a callable for generic calculation methods of correlation, e.g. histogram intersection (:issue:`22684`)
383374
- :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`)
385375
- :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.
386376
See the :ref:`section on writing HTML <io.html>` in the IO docs for example usage. (:issue:`2679`)
387377
- :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`)
389379
- :func:`to_datetime` now supports the ``%Z`` and ``%z`` directive when passed into ``format`` (:issue:`13486`)
390380
- :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`)
391381
- :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
407397
The default compression for ``to_csv``, ``to_json``, and ``to_pickle`` methods has been updated to ``'infer'`` (:issue:`22004`).
408398
- :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`).
409399
- :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`)
411401
- :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`).
415406
- :meth:`Series.resample` and :meth:`DataFrame.resample` have gained the :meth:`pandas.core.resample.Resampler.quantile` (:issue:`15023`).
416407
- :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`)
417408
- :meth:`pandas.api.types.is_list_like` has gained a keyword ``allow_sets`` which is ``True`` by default; if ``False``,
418409
all instances of ``set`` will not be considered "list-like" anymore (:issue:`23061`)
419410
- :meth:`Index.to_frame` now supports overriding column name(s) (:issue:`22580`).
420411
- :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`).
422413
- Compatibility with Matplotlib 3.0 (:issue:`22790`).
423414
- Added :meth:`Interval.overlaps`, :meth:`IntervalArray.overlaps`, and :meth:`IntervalIndex.overlaps` for determining overlaps between interval-like objects (:issue:`21998`)
424415
- :func:`read_fwf` now accepts keyword ``infer_nrows`` (:issue:`15138`).
@@ -433,7 +424,7 @@ Other Enhancements
433424
- :class:`IntervalIndex` has gained the :attr:`~IntervalIndex.is_overlapping` attribute to indicate if the ``IntervalIndex`` contains any overlapping intervals (:issue:`23309`)
434425
- :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`)
435426
- :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`)
437428

438429
.. _whatsnew_0240.api_breaking:
439430

@@ -445,8 +436,8 @@ Pandas 0.24.0 includes a number of API breaking changes.
445436

446437
.. _whatsnew_0240.api_breaking.deps:
447438

448-
Dependencies have increased minimum versions
449-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
439+
Increased minimum versions for dependencies
440+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
450441

451442
We have updated our minimum supported versions of dependencies (:issue:`21242`, :issue:`18742`, :issue:`23774`, :issue:`24767`).
452443
If installed, we now require:
@@ -1174,17 +1165,19 @@ Other API Changes
11741165

11751166
.. _whatsnew_0240.api.extension:
11761167

1177-
ExtensionType Changes
1178-
~~~~~~~~~~~~~~~~~~~~~
1168+
Extension Type Changes
1169+
~~~~~~~~~~~~~~~~~~~~~~
11791170

11801171
**Equality and Hashability**
11811172

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
11831176
a default ``__eq__`` and ``__hash__``. If you have a parametrized dtype, you should
11841177
update the ``ExtensionDtype._metadata`` tuple to match the signature of your
11851178
``__init__`` method. See :class:`pandas.api.extensions.ExtensionDtype` for more (:issue:`22476`).
11861179

1187-
**Reshaping changes**
1180+
**New and changed methods**
11881181

11891182
- :meth:`~pandas.api.types.ExtensionArray.dropna` has been added (:issue:`21185`)
11901183
- :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
12021195
- Added :meth:`pandas.api.types.register_extension_dtype` to register an extension type with pandas (:issue:`22664`)
12031196
- Updated the ``.type`` attribute for ``PeriodDtype``, ``DatetimeTZDtype``, and ``IntervalDtype`` to be instances of the dtype (``Period``, ``Timestamp``, and ``Interval`` respectively) (:issue:`22938`)
12041197

1198+
.. _whatsnew_0240.enhancements.extension_array_operators:
1199+
1200+
**Operator support**
1201+
1202+
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+
12051213
**Other changes**
12061214

12071215
- 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`)
12081217
- 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`)
12091218

12101219
**Bug Fixes**
@@ -1253,7 +1262,6 @@ Deprecations
12531262
- 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`)
12541263
- The methods :meth:`Series.str.partition` and :meth:`Series.str.rpartition` have deprecated the ``pat`` keyword in favor of ``sep`` (:issue:`22676`)
12551264
- 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`)
12571265
- :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`)
12581266
- Constructing a :class:`TimedeltaIndex` from data with ``datetime64``-dtyped data is deprecated, will raise ``TypeError`` in a future version (:issue:`23539`)
12591267
- Constructing a :class:`DatetimeIndex` from data with ``timedelta64``-dtyped data is deprecated, will raise ``TypeError`` in a future version (:issue:`23675`)

0 commit comments

Comments
 (0)