Skip to content

Commit 0c06344

Browse files
author
Mateusz
committed
TYP: Fix core/groupby/generic.py lexsort attr-defined type ignore
GH37715
1 parent 04e01a1 commit 0c06344

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pandas/core/groupby/generic.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626

2727
import numpy as np
2828

29-
from pandas._libs import reduction as libreduction
29+
from pandas._libs import (
30+
Interval,
31+
reduction as libreduction,
32+
)
3033
from pandas._typing import (
3134
ArrayLike,
3235
Manager,
@@ -652,12 +655,9 @@ def value_counts(
652655

653656
if is_interval_dtype(lab.dtype):
654657
# TODO: should we do this inside II?
658+
lab_interval = cast(Interval, lab)
655659

656-
# error: "ndarray" has no attribute "left"
657-
# error: "ndarray" has no attribute "right"
658-
sorter = np.lexsort(
659-
(lab.left, lab.right, ids) # type: ignore[attr-defined]
660-
)
660+
sorter = np.lexsort((lab_interval.left, lab_interval.right, ids))
661661
else:
662662
sorter = np.lexsort((lab, ids))
663663

0 commit comments

Comments
 (0)