Skip to content

Commit cb32477

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

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pandas/core/groupby/generic.py

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

2727
import numpy as np
2828

29+
from pandas._libs import Interval
2930
from pandas._libs import reduction as libreduction
3031
from pandas._typing import (
3132
ArrayLike,
@@ -650,12 +651,9 @@ def value_counts(
650651

651652
if is_interval_dtype(lab.dtype):
652653
# TODO: should we do this inside II?
654+
lab_interval = cast(Interval, lab)
653655

654-
# error: "ndarray" has no attribute "left"
655-
# error: "ndarray" has no attribute "right"
656-
sorter = np.lexsort(
657-
(lab.left, lab.right, ids) # type: ignore[attr-defined]
658-
)
656+
sorter = np.lexsort((lab_interval.left, lab_interval.right, ids))
659657
else:
660658
sorter = np.lexsort((lab, ids))
661659

0 commit comments

Comments
 (0)