Skip to content

Commit cba9d45

Browse files
authored
TYP: changed variable cat_array to cat_array_list in dtypes.py and arr_list in categorical.py (#44664)
1 parent 54e9988 commit cba9d45

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

pandas/core/arrays/categorical.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,8 @@ def __init__(
421421
if null_mask.any():
422422
# We remove null values here, then below will re-insert
423423
# them, grep "full_codes"
424-
425-
# error: Incompatible types in assignment (expression has type
426-
# "List[Any]", variable has type "ExtensionArray")
427-
arr = [ # type: ignore[assignment]
428-
values[idx] for idx in np.where(~null_mask)[0]
429-
]
430-
arr = sanitize_array(arr, None)
424+
arr_list = [values[idx] for idx in np.where(~null_mask)[0]]
425+
arr = sanitize_array(arr_list, None)
431426
values = arr
432427

433428
if dtype.categories is None:

pandas/core/dtypes/dtypes.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,7 @@ def _hash_categories(self) -> int:
465465
[cat_array, np.arange(len(cat_array), dtype=cat_array.dtype)]
466466
)
467467
else:
468-
# error: Incompatible types in assignment (expression has type
469-
# "List[ndarray]", variable has type "ndarray")
470-
cat_array = [cat_array] # type: ignore[assignment]
468+
cat_array = np.array([cat_array])
471469
combined_hashed = combine_hash_arrays(iter(cat_array), num_items=len(cat_array))
472470
return np.bitwise_xor.reduce(combined_hashed)
473471

0 commit comments

Comments
 (0)