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 dafa5dd commit cb32477Copy full SHA for cb32477
pandas/core/groupby/generic.py
@@ -26,6 +26,7 @@
26
27
import numpy as np
28
29
+from pandas._libs import Interval
30
from pandas._libs import reduction as libreduction
31
from pandas._typing import (
32
ArrayLike,
@@ -650,12 +651,9 @@ def value_counts(
650
651
652
if is_interval_dtype(lab.dtype):
653
# TODO: should we do this inside II?
654
+ lab_interval = cast(Interval, lab)
655
- # error: "ndarray" has no attribute "left"
- # error: "ndarray" has no attribute "right"
656
- sorter = np.lexsort(
657
- (lab.left, lab.right, ids) # type: ignore[attr-defined]
658
- )
+ sorter = np.lexsort((lab_interval.left, lab_interval.right, ids))
659
else:
660
sorter = np.lexsort((lab, ids))
661
0 commit comments