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 04e01a1 commit 52bece7Copy full SHA for 52bece7
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,
@@ -652,12 +653,9 @@ def value_counts(
652
653
654
if is_interval_dtype(lab.dtype):
655
# TODO: should we do this inside II?
656
+ lab_interval = cast(Interval, lab)
657
- # error: "ndarray" has no attribute "left"
- # error: "ndarray" has no attribute "right"
658
- sorter = np.lexsort(
659
- (lab.left, lab.right, ids) # type: ignore[attr-defined]
660
- )
+ sorter = np.lexsort((lab_interval.left, lab_interval.right, ids))
661
else:
662
sorter = np.lexsort((lab, ids))
663
0 commit comments