We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f98429 commit e839cb4Copy full SHA for e839cb4
pandas/core/reshape/reshape.py
@@ -419,7 +419,10 @@ def _repeater(self) -> np.ndarray:
419
# Otherwise, we just use each level item exactly once:
420
stride = len(self.removed_level) + self.has_nan
421
repeater = np.arange(stride) - self.lift
422
- if self.has_nan and self.lift == 0:
+ if self.has_nan and not self.sort:
423
+ assert self.unique_nan_index > -1, (
424
+ "`unique_nan_index` not properly initialized"
425
+ )
426
# assign -1 where should be nan according to the unique values.
427
repeater[self.unique_nan_index] = -1
428
# compensate for the removed index level
0 commit comments