Skip to content

Commit 0e04921

Browse files
committed
fix(reshape): fix mypy errors
Use `np.unique` instead of `unique`.
1 parent 7f328d5 commit 0e04921

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

pandas/core/reshape/reshape.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,11 @@ def __init__(
143143
self.removed_level_full = index.levels[self.level]
144144
self.unique_nan_index: int = -1
145145
if not self.sort:
146-
unique_codes = unique(self.index.codes[self.level])
146+
unique_codes = np.unique(self.index.codes[self.level])
147147
if self.has_nan:
148148
# drop nan codes, because they are not represented in level
149149
nan_mask = unique_codes == -1
150150

151-
if TYPE_CHECKING:
152-
# make explicit that nan_mask is an array
153-
# to remove this pyright diagnostic:
154-
# The method "__invert__" in class "bool" is deprecated
155-
nan_mask = cast(ArrayLike, nan_mask)
156-
157151
unique_codes = unique_codes[~nan_mask]
158152
self.unique_nan_index = np.flatnonzero(nan_mask)[0]
159153

0 commit comments

Comments
 (0)