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
@@ -31,6 +32,62 @@ See the :ref:`ExtensionArray Operator Support
31
32
<extending.extension.operator>` documentation section for details on both
32
33
ways of adding operator support.
33
34
35
+
.. _whatsnew_0240.enhancements.intna:
36
+
37
+
Optional Integer NA Support
38
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
+
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>`.
41
+
Here is an example of the usage.
42
+
43
+
We can construct a ``Series`` with the specified dtype. The dtype string ``Int64`` is a pandas ``ExtensionDtype``. Specifying a list or array using the traditional missing value
44
+
marker of ``np.nan`` will infer to integer dtype. The display of the ``Series`` will also use the ``NaN`` to indicate missing values in string outputs. (:issue:`20700`, :issue:`20747`)
45
+
46
+
.. ipython:: python
47
+
48
+
s = pd.Series([1, 2, np.nan], dtype='Int64')
49
+
s
50
+
51
+
52
+
Operations on these dtypes will propagate ``NaN`` as other pandas operations.
53
+
54
+
.. ipython:: python
55
+
56
+
# arithmetic
57
+
s + 1
58
+
59
+
# comparison
60
+
s == 1
61
+
62
+
# indexing
63
+
s.iloc[1:3]
64
+
65
+
# operate with other dtypes
66
+
s + s.iloc[1:3].astype('Int8')
67
+
68
+
# coerce when needed
69
+
s + 0.01
70
+
71
+
These dtypes can operate as part of of ``DataFrame``.
The Integer NA support currently uses the captilized dtype version, e.g. ``Int8`` as compared to the traditional ``int8``. This may be changed at a future date.
90
+
34
91
.. _whatsnew_0240.enhancements.read_html:
35
92
36
93
``read_html`` Enhancements
@@ -258,6 +315,7 @@ Previous Behavior:
258
315
ExtensionType Changes
259
316
^^^^^^^^^^^^^^^^^^^^^
260
317
318
+
- ``ExtensionArray`` has gained the abstract methods ``.dropna()`` (:issue:`21185`)
261
319
- ``ExtensionDtype`` has gained the ability to instantiate from string dtypes, e.g. ``decimal`` would instantiate a registered ``DecimalDtype``; furthermore
262
320
the ``ExtensionDtype`` has gained the method ``construct_array_type`` (:issue:`21185`)
263
321
- The ``ExtensionArray`` constructor, ``_from_sequence`` now take the keyword arg ``copy=False`` (:issue:`21185`)
@@ -312,6 +370,7 @@ Other API Changes
312
370
- Invalid construction of ``IntervalDtype`` will now always raise a ``TypeError`` rather than a ``ValueError`` if the subdtype is invalid (:issue:`21185`)
313
371
- Trying to reindex a ``DataFrame`` with a non unique ``MultiIndex`` now raises a ``ValueError`` instead of an ``Exception`` (:issue:`21770`)
314
372
- :meth:`PeriodIndex.tz_convert` and :meth:`PeriodIndex.tz_localize` have been removed (:issue:`21781`)
373
+
- :class:`Index` subtraction will attempt to operate element-wise instead of raising ``TypeError`` (:issue:`19369`)
315
374
- :class:`pandas.io.formats.style.Styler` supports a ``number-format`` property when using :meth:`~pandas.io.formats.style.Styler.to_excel`
316
375
317
376
.. _whatsnew_0240.deprecations:
@@ -351,7 +410,7 @@ Performance Improvements
351
410
- Improved performance of :meth:`HDFStore.groups` (and dependent functions like
352
411
:meth:`~HDFStore.keys`. (i.e. ``x in store`` checks are much faster)
353
412
(:issue:`21372`)
354
-
-
413
+
- Improved the performance of :func:`pandas.get_dummies` with ``sparse=True`` (:issue:`21997`)
0 commit comments