Skip to content

TYP: changed variable cat_array to cat_array_list in dtypes.py and arr_list in categorical.py #44664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,8 @@ def __init__(
if null_mask.any():
# We remove null values here, then below will re-insert
# them, grep "full_codes"

# error: Incompatible types in assignment (expression has type
# "List[Any]", variable has type "ExtensionArray")
arr = [ # type: ignore[assignment]
values[idx] for idx in np.where(~null_mask)[0]
]
arr = sanitize_array(arr, None)
arr_list = [values[idx] for idx in np.where(~null_mask)[0]]
arr = sanitize_array(arr_list, None)
values = arr

if dtype.categories is None:
Expand Down
4 changes: 1 addition & 3 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,9 +465,7 @@ def _hash_categories(self) -> int:
[cat_array, np.arange(len(cat_array), dtype=cat_array.dtype)]
)
else:
# error: Incompatible types in assignment (expression has type
# "List[ndarray]", variable has type "ndarray")
cat_array = [cat_array] # type: ignore[assignment]
cat_array = np.array([cat_array])
combined_hashed = combine_hash_arrays(iter(cat_array), num_items=len(cat_array))
return np.bitwise_xor.reduce(combined_hashed)

Expand Down