diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index 769ae52744c74..1398db6960cc8 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -49,6 +49,7 @@ from pandas.core.dtypes.common import ( ensure_int64, ensure_object, + ensure_platform_int, is_categorical_dtype, is_datetime64_dtype, is_dict_like, @@ -533,7 +534,7 @@ def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike: # error: Incompatible types in assignment (expression has type "ndarray", # variable has type "Categorical") result = take_nd( # type: ignore[assignment] - new_cats, libalgos.ensure_platform_int(self._codes) + new_cats, ensure_platform_int(self._codes) ) return result diff --git a/pandas/tests/apply/test_frame_transform.py b/pandas/tests/apply/test_frame_transform.py index 1a12cbff47092..7a626ce6312c5 100644 --- a/pandas/tests/apply/test_frame_transform.py +++ b/pandas/tests/apply/test_frame_transform.py @@ -162,8 +162,6 @@ def test_transform_method_name(method): frame_kernels_raise = [x for x in frame_transform_kernels if x not in wont_fail] -# mypy doesn't allow adding lists of different types -# https://github.com/python/mypy/issues/5492 @pytest.mark.parametrize("op", [*frame_kernels_raise, lambda x: x + 1]) def test_transform_bad_dtype(op, frame_or_series): # GH 35964