File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 11
11
from functools import partial
12
12
from textwrap import dedent
13
13
from typing import (
14
+ TYPE_CHECKING ,
14
15
Any ,
15
16
Callable ,
16
17
Hashable ,
89
90
90
91
from pandas .plotting import boxplot_frame_groupby
91
92
93
+ if TYPE_CHECKING :
94
+ from pandas import Interval
95
+
92
96
# TODO(typing) the return value on this callable should be any *scalar*.
93
97
AggScalar = Union [str , Callable [..., Any ]]
94
98
# TODO: validate types on ScalarResult and move to _typing
@@ -650,12 +654,9 @@ def value_counts(
650
654
651
655
if is_interval_dtype (lab .dtype ):
652
656
# TODO: should we do this inside II?
657
+ lab_interval = cast (Interval , lab )
653
658
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
- )
659
+ sorter = np .lexsort ((lab_interval .left , lab_interval .right , ids ))
659
660
else :
660
661
sorter = np .lexsort ((lab , ids ))
661
662
You can’t perform that action at this time.
0 commit comments