From 4140f02024c829e6f22cc71fa695fba21c405f40 Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Fri, 24 Jan 2020 08:43:57 -0500 Subject: [PATCH 1/2] move convert_dtypes to 1.0 --- doc/source/whatsnew/v1.0.0.rst | 30 ++++++++++++++++++++++++++++++ doc/source/whatsnew/v1.1.0.rst | 30 ------------------------------ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 087265858e850..94e537b4a997f 100755 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -157,6 +157,36 @@ You can use the alias ``"boolean"`` as well. s = pd.Series([True, False, None], dtype="boolean") s +.. _whatsnew_100.convert_dtypes: + +``convert_dtypes`` method to ease use of supported extension dtypes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +In order to encourage use of the extension dtypes ``StringDtype``, +``BooleanDtype``, ``Int64Dtype``, ``Int32Dtype``, etc., that support ``pd.NA``, the +methods :meth:`DataFrame.convert_dtypes` and :meth:`Series.convert_dtypes` +have been introduced. (:issue:`29752`) (:issue:`30929`) + +Example: + +.. ipython:: python + + df = pd.DataFrame({'x': ['abc', None, 'def'], + 'y': [1, 2, np.nan], + 'z': [True, False, True]}) + df + df.dtypes + +.. ipython:: python + + converted = df.convert_dtypes() + converted + converted.dtypes + +This is especially useful after reading in data using readers such as :func:`read_csv` +and :func:`read_excel`. +See :ref:`here ` for a description. + .. _whatsnew_100.numba_rolling_apply: Using Numba in ``rolling.apply`` and ``expanding.apply`` diff --git a/doc/source/whatsnew/v1.1.0.rst b/doc/source/whatsnew/v1.1.0.rst index d0cf92b60fe0d..b41fbe880a65d 100644 --- a/doc/source/whatsnew/v1.1.0.rst +++ b/doc/source/whatsnew/v1.1.0.rst @@ -13,36 +13,6 @@ including other versions of pandas. Enhancements ~~~~~~~~~~~~ -.. _whatsnew_100.convert_dtypes: - -``convert_dtypes`` method to ease use of supported extension dtypes -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -In order to encourage use of the extension dtypes ``StringDtype``, -``BooleanDtype``, ``Int64Dtype``, ``Int32Dtype``, etc., that support ``pd.NA``, the -methods :meth:`DataFrame.convert_dtypes` and :meth:`Series.convert_dtypes` -have been introduced. (:issue:`29752`) (:issue:`30929`) - -Example: - -.. ipython:: python - - df = pd.DataFrame({'x': ['abc', None, 'def'], - 'y': [1, 2, np.nan], - 'z': [True, False, True]}) - df - df.dtypes - -.. ipython:: python - - converted = df.convert_dtypes() - converted - converted.dtypes - -This is especially useful after reading in data using readers such as :func:`read_csv` -and :func:`read_excel`. -See :ref:`here ` for a description. - .. _whatsnew_110.period_index_partial_string_slicing: Nonmonotonic PeriodIndex Partial String Slicing From a65044f8339a8d2b9e9c27093cbba3ba0c310fd1 Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Fri, 24 Jan 2020 09:16:18 -0500 Subject: [PATCH 2/2] fix docstring versionadded --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index c502adcdb09e0..ca89c3f7209ca 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5741,7 +5741,7 @@ def convert_dtypes( """ Convert columns to best possible dtypes using dtypes supporting ``pd.NA``. - .. versionadded:: 1.1.0 + .. versionadded:: 1.0.0 Parameters ----------