From 6d4e6661458da21280d20896391d550a5341701e Mon Sep 17 00:00:00 2001 From: pbrochart Date: Sun, 20 Apr 2025 16:07:57 +0200 Subject: [PATCH 1/2] PERF: Restore old performances with .isin() on columns typed as np.uint64 --- pandas/core/algorithms.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index e6847b380a7e8..cea46a08c1153 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -56,6 +56,7 @@ is_object_dtype, is_signed_integer_dtype, needs_i8_conversion, + is_dtype_equal, ) from pandas.core.dtypes.concat import concat_compat from pandas.core.dtypes.dtypes import ( @@ -511,6 +512,7 @@ def isin(comps: ListLike, values: ListLike) -> npt.NDArray[np.bool_]: len(values) > 0 and values.dtype.kind in "iufcb" and not is_signed_integer_dtype(comps) + and not is_dtype_equal(values, comps) ): # GH#46485 Use object to avoid upcast to float64 later # TODO: Share with _find_common_type_compat From 33fac00824fc27c99938d4690da1a73b17fd0472 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 20 Apr 2025 17:11:15 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- 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 cea46a08c1153..7fc391d3ffb51 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -47,6 +47,7 @@ is_bool_dtype, is_complex_dtype, is_dict_like, + is_dtype_equal, is_extension_array_dtype, is_float, is_float_dtype, @@ -56,7 +57,6 @@ is_object_dtype, is_signed_integer_dtype, needs_i8_conversion, - is_dtype_equal, ) from pandas.core.dtypes.concat import concat_compat from pandas.core.dtypes.dtypes import (