Skip to content

Commit 52bece7

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

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,
@@ -652,12 +653,9 @@ def value_counts(
652653

653654
if is_interval_dtype(lab.dtype):
654655
# TODO: should we do this inside II?
656+
lab_interval = cast(Interval, lab)
655657

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-
)
658+
sorter = np.lexsort((lab_interval.left, lab_interval.right, ids))
661659
else:
662660
sorter = np.lexsort((lab, ids))
663661

0 commit comments

Comments
 (0)