From 28a5b32a24db12cd297fea096a38d09b960e9876 Mon Sep 17 00:00:00 2001 From: Sukriti Bhardwaj Date: Sat, 20 Feb 2021 15:19:04 -0500 Subject: [PATCH 1/6] DOC: Updated convert_dtype of Series.apply --- pandas/core/series.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index cbb66918a661b..ea5173eb0ba4d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4056,7 +4056,10 @@ def apply( Python function or NumPy ufunc to apply. convert_dtype : bool, default True Try to find better dtype for elementwise function results. If - False, leave as dtype=object. + False, leave as dtype=object. For the dtypes Categorical, + Sparse, Interval, Period, DatetimeArray and TimedeltaArray + the original dtype is kept. + args : tuple Positional arguments passed to func after the series value. **kwargs From 9bef8427a3203f3f6faecc8ef68242218bac69fa Mon Sep 17 00:00:00 2001 From: Sukriti Bhardwaj Date: Sat, 20 Feb 2021 15:39:44 -0500 Subject: [PATCH 2/6] DOC: Updated convert_dtype for pandas.Series.apply --- pandas/core/series.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index ea5173eb0ba4d..35447771521e7 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4058,8 +4058,7 @@ def apply( Try to find better dtype for elementwise function results. If False, leave as dtype=object. For the dtypes Categorical, Sparse, Interval, Period, DatetimeArray and TimedeltaArray - the original dtype is kept. - + the original dtype is kept. args : tuple Positional arguments passed to func after the series value. **kwargs From 1555836fbf0b8d3cf1388b9d5134d06912f8f356 Mon Sep 17 00:00:00 2001 From: Sukriti Bhardwaj Date: Sat, 20 Feb 2021 16:37:54 -0500 Subject: [PATCH 3/6] DOC: Updated convert_dtype for pandas.Series.apply --- pandas/core/series.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 35447771521e7..e49a5b3c0fa4c 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4058,7 +4058,7 @@ def apply( Try to find better dtype for elementwise function results. If False, leave as dtype=object. For the dtypes Categorical, Sparse, Interval, Period, DatetimeArray and TimedeltaArray - the original dtype is kept. + the original dtype is kept. args : tuple Positional arguments passed to func after the series value. **kwargs From 3dfad1c6870b1c93963a5bc39f0adf6ff4327498 Mon Sep 17 00:00:00 2001 From: Sukriti Bhardwaj Date: Sun, 28 Feb 2021 20:03:04 -0500 Subject: [PATCH 4/6] Editing the doc --- pandas/core/series.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index e49a5b3c0fa4c..6c440652d7d80 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4056,9 +4056,9 @@ def apply( Python function or NumPy ufunc to apply. convert_dtype : bool, default True Try to find better dtype for elementwise function results. If - False, leave as dtype=object. For the dtypes Categorical, - Sparse, Interval, Period, DatetimeArray and TimedeltaArray - the original dtype is kept. + False, leave as dtype=object. Note that conversion does not + happen for extension array dtypes which have a map method + (e.g. Categorical). args : tuple Positional arguments passed to func after the series value. **kwargs From 8cb2910c232a206c039be9d5b0022b029b54a8a9 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Wed, 10 Mar 2021 09:25:58 +0000 Subject: [PATCH 5/6] only mention categorical as example --- pandas/core/series.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 6c440652d7d80..d5ee7a7836dcb 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4057,8 +4057,7 @@ def apply( convert_dtype : bool, default True Try to find better dtype for elementwise function results. If False, leave as dtype=object. Note that conversion does not - happen for extension array dtypes which have a map method - (e.g. Categorical). + happen for extension array dtypes, such as Categorical. args : tuple Positional arguments passed to func after the series value. **kwargs From 8b9c378e5309f058b5e533a61513103cee74a7f1 Mon Sep 17 00:00:00 2001 From: Sukriti Bhardwaj Date: Fri, 16 Apr 2021 05:18:42 -0400 Subject: [PATCH 6/6] updates --- pandas/core/series.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/core/series.py b/pandas/core/series.py index 6c440652d7d80..7983d0d9a3b39 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4056,9 +4056,8 @@ def apply( Python function or NumPy ufunc to apply. convert_dtype : bool, default True Try to find better dtype for elementwise function results. If - False, leave as dtype=object. Note that conversion does not - happen for extension array dtypes which have a map method - (e.g. Categorical). + False, leave as dtype=object. Note that the dtype is always + preserved for extension array dtypes, such as Categorical. args : tuple Positional arguments passed to func after the series value. **kwargs