Skip to content

Commit ac7c043

Browse files
authored
TYP: Fix typing for searchsorted (#42788)
1 parent 91872e7 commit ac7c043

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pandas/core/reshape/tile.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import (
55
Any,
66
Callable,
7+
Literal,
78
)
89

910
import numpy as np
@@ -417,12 +418,8 @@ def _bins_to_cuts(
417418
else:
418419
bins = unique_bins
419420

420-
side = "left" if right else "right"
421-
# error: No overload variant of "searchsorted" of "ndarray" matches
422-
# argument types "Any", "str"
423-
ids = ensure_platform_int(
424-
bins.searchsorted(x, side=side) # type: ignore[call-overload]
425-
)
421+
side: Literal["left", "right"] = "left" if right else "right"
422+
ids = ensure_platform_int(bins.searchsorted(x, side=side))
426423

427424
if include_lowest:
428425
ids[np.asarray(x) == bins[0]] = 1

0 commit comments

Comments
 (0)