From ff66846faa76364e5303c6aa1639808644faea23 Mon Sep 17 00:00:00 2001 From: Risako Date: Thu, 22 Jul 2021 11:40:04 +0900 Subject: [PATCH 1/3] update input of core.algorithms.duplicated --- pandas/core/algorithms.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index df9f3d07ce7fd..7cb938138a0ec 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -90,6 +90,7 @@ ) from pandas.core.arrays import ( DatetimeArray, + ExtensionArray, TimedeltaArray, ) @@ -903,7 +904,8 @@ def value_counts_arraylike(values, dropna: bool): def duplicated( - values: ArrayLike, keep: Literal["first", "last", False] = "first" + values: ExtensionArray | np.ndarray | Series, + keep: Literal["first", "last", False] = "first", ) -> np.ndarray: """ Return boolean ndarray denoting duplicate values. From 1c0416992aaa9a5fd86c31a4f7b5ce1e2707cd53 Mon Sep 17 00:00:00 2001 From: Risako Date: Thu, 22 Jul 2021 12:57:06 +0900 Subject: [PATCH 2/3] fix order of inputs according to docs --- pandas/core/algorithms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 7cb938138a0ec..74bf396de76b4 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -904,7 +904,7 @@ def value_counts_arraylike(values, dropna: bool): def duplicated( - values: ExtensionArray | np.ndarray | Series, + values: np.ndarray | ExtensionArray | Series, keep: Literal["first", "last", False] = "first", ) -> np.ndarray: """ From 984a22a3f53b9a6c7443f93a8446932255b311f7 Mon Sep 17 00:00:00 2001 From: Risako Date: Fri, 23 Jul 2021 18:26:25 +0900 Subject: [PATCH 3/3] fix datatype to AnyArrayLike --- pandas/core/algorithms.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 74bf396de76b4..c0ed515b6640a 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -90,7 +90,6 @@ ) from pandas.core.arrays import ( DatetimeArray, - ExtensionArray, TimedeltaArray, ) @@ -904,7 +903,7 @@ def value_counts_arraylike(values, dropna: bool): def duplicated( - values: np.ndarray | ExtensionArray | Series, + values: AnyArrayLike, keep: Literal["first", "last", False] = "first", ) -> np.ndarray: """ @@ -912,7 +911,7 @@ def duplicated( Parameters ---------- - values : nd.array, ExtensionArray or Series + values : nd.array, ExtensionArray, Series or Index Array over which to check for duplicate values. keep : {'first', 'last', False}, default 'first' - ``first`` : Mark duplicates as ``True`` except for the first