File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1111from functools import partial
1212from textwrap import dedent
1313from typing import (
14+ TYPE_CHECKING ,
1415 Any ,
1516 Callable ,
1617 Hashable ,
8990
9091from pandas .plotting import boxplot_frame_groupby
9192
93+ if TYPE_CHECKING :
94+ from pandas import Interval
95+
9296# TODO(typing) the return value on this callable should be any *scalar*.
9397AggScalar = Union [str , Callable [..., Any ]]
9498# TODO: validate types on ScalarResult and move to _typing
@@ -650,12 +654,9 @@ def value_counts(
650654
651655 if is_interval_dtype (lab .dtype ):
652656 # TODO: should we do this inside II?
657+ lab_interval = cast (Interval , lab )
653658
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 ))
659660 else :
660661 sorter = np .lexsort ((lab , ids ))
661662
You can’t perform that action at this time.
0 commit comments