Skip to content

Commit d91bebb

Browse files
committed
feat(series): truediv for bools
1 parent 67755ef commit d91bebb

File tree

6 files changed

+408
-47
lines changed

6 files changed

+408
-47
lines changed

pandas-stubs/core/series.pyi

Lines changed: 101 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2097,27 +2097,48 @@ class Series(IndexOpsMixin[S1], NDFrame):
20972097
def __sub__(self, other: num | _ListLike | Series) -> Series: ...
20982098
@overload
20992099
def __truediv__(
2100-
self: Series[Never], other: Scalar | _ListLike | Series
2100+
self: Series[Never], other: complex | _ListLike | Series
21012101
) -> Series: ...
21022102
@overload
21032103
def __truediv__(self, other: Series[Never]) -> Series: ...
21042104
@overload
21052105
def __truediv__(
2106-
self: Series[int],
2106+
self: Series[bool],
21072107
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
21082108
) -> Series[float]: ...
21092109
@overload
21102110
def __truediv__(
2111-
self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX]
2111+
self: Series[bool],
2112+
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
21122113
) -> Series[_T_COMPLEX]: ...
21132114
@overload
21142115
def __truediv__(
2115-
self: Series[int], other: np_ndarray_complex
2116-
) -> Series[complex]: ...
2116+
self: Series[int],
2117+
other: (
2118+
_T_INT
2119+
| Sequence[_T_INT]
2120+
| np_ndarray_bool
2121+
| np_ndarray_anyint
2122+
| np_ndarray_float
2123+
| Series[_T_INT]
2124+
),
2125+
) -> Series[float]: ...
2126+
@overload
2127+
def __truediv__(
2128+
self: Series[int],
2129+
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
2130+
) -> Series[_T_COMPLEX]: ...
21172131
@overload
21182132
def __truediv__(
21192133
self: Series[float],
2120-
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
2134+
other: (
2135+
_T_INT
2136+
| Sequence[_T_INT]
2137+
| np_ndarray_bool
2138+
| np_ndarray_anyint
2139+
| np_ndarray_float
2140+
| Series[_T_INT]
2141+
),
21212142
) -> Series[float]: ...
21222143
@overload
21232144
def __truediv__(
@@ -2126,17 +2147,17 @@ class Series(IndexOpsMixin[S1], NDFrame):
21262147
) -> Series[_T_COMPLEX]: ...
21272148
@overload
21282149
def __truediv__(
2129-
self: Series[float], other: np_ndarray_complex
2150+
self: Series[_T_COMPLEX], other: np_ndarray_complex
21302151
) -> Series[complex]: ...
21312152
@overload
21322153
def __truediv__(
21332154
self: Series[complex],
21342155
other: (
21352156
_T_COMPLEX
21362157
| Sequence[_T_COMPLEX]
2158+
| np_ndarray_bool
21372159
| np_ndarray_anyint
21382160
| np_ndarray_float
2139-
| np_ndarray_complex
21402161
| Series[_T_COMPLEX]
21412162
),
21422163
) -> Series[complex]: ...
@@ -2145,7 +2166,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
21452166
@overload
21462167
def truediv(
21472168
self: Series[Never],
2148-
other: Scalar | _ListLike | Series,
2169+
other: complex | _ListLike | Series,
21492170
level: Level | None = None,
21502171
fill_value: float | None = None,
21512172
axis: AxisIndex = 0,
@@ -2160,15 +2181,15 @@ class Series(IndexOpsMixin[S1], NDFrame):
21602181
) -> Series: ...
21612182
@overload
21622183
def truediv(
2163-
self: Series[int],
2184+
self: Series[bool],
21642185
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
21652186
level: Level | None = None,
21662187
fill_value: float | None = None,
21672188
axis: AxisIndex = 0,
21682189
) -> Series[float]: ...
21692190
@overload
21702191
def truediv(
2171-
self: Series[int],
2192+
self: Series[bool],
21722193
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
21732194
level: Level | None = None,
21742195
fill_value: float | None = None,
@@ -2177,11 +2198,26 @@ class Series(IndexOpsMixin[S1], NDFrame):
21772198
@overload
21782199
def truediv(
21792200
self: Series[int],
2180-
other: np_ndarray_complex,
2201+
other: (
2202+
_T_INT
2203+
| Sequence[_T_INT]
2204+
| np_ndarray_bool
2205+
| np_ndarray_anyint
2206+
| np_ndarray_float
2207+
| Series[_T_INT]
2208+
),
21812209
level: Level | None = None,
21822210
fill_value: float | None = None,
21832211
axis: AxisIndex = 0,
2184-
) -> Series[complex]: ...
2212+
) -> Series[float]: ...
2213+
@overload
2214+
def truediv(
2215+
self: Series[int],
2216+
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
2217+
level: Level | None = None,
2218+
fill_value: float | None = None,
2219+
axis: AxisIndex = 0,
2220+
) -> Series[_T_COMPLEX]: ...
21852221
@overload
21862222
def truediv(
21872223
self: Series[float],
@@ -2200,7 +2236,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
22002236
) -> Series[_T_COMPLEX]: ...
22012237
@overload
22022238
def truediv(
2203-
self: Series[float],
2239+
self: Series[_T_COMPLEX],
22042240
other: np_ndarray_complex,
22052241
level: Level | None = None,
22062242
fill_value: float | None = None,
@@ -2212,9 +2248,9 @@ class Series(IndexOpsMixin[S1], NDFrame):
22122248
other: (
22132249
_T_COMPLEX
22142250
| Sequence[_T_COMPLEX]
2251+
| np_ndarray_bool
22152252
| np_ndarray_anyint
22162253
| np_ndarray_float
2217-
| np_ndarray_complex
22182254
| Series[_T_COMPLEX]
22192255
),
22202256
level: Level | None = None,
@@ -2231,20 +2267,31 @@ class Series(IndexOpsMixin[S1], NDFrame):
22312267
) -> Series: ...
22322268
div = truediv
22332269
@overload
2234-
def __rtruediv__(self: Series[Never], other: Scalar | _ListLike) -> Series: ...
2270+
def __rtruediv__(self: Series[Never], other: complex | _ListLike) -> Series: ...
22352271
@overload
22362272
def __rtruediv__(
2237-
self: Series[int],
2238-
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float,
2273+
self: Series[bool],
2274+
other: _T_INT | Sequence[_T_INT] | np_ndarray_anyint | np_ndarray_float,
22392275
) -> Series[float]: ...
22402276
@overload
22412277
def __rtruediv__(
2242-
self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX]
2278+
self: Series[bool], other: _T_COMPLEX | Sequence[_T_COMPLEX]
22432279
) -> Series[_T_COMPLEX]: ...
22442280
@overload
22452281
def __rtruediv__(
2246-
self: Series[int], other: np_ndarray_complex
2247-
) -> Series[complex]: ...
2282+
self: Series[int],
2283+
other: (
2284+
_T_INT
2285+
| Sequence[_T_INT]
2286+
| np_ndarray_bool
2287+
| np_ndarray_anyint
2288+
| np_ndarray_float
2289+
),
2290+
) -> Series[float]: ...
2291+
@overload
2292+
def __rtruediv__(
2293+
self: Series[int], other: _T_COMPLEX | Sequence[_T_COMPLEX]
2294+
) -> Series[_T_COMPLEX]: ...
22482295
@overload
22492296
def __rtruediv__(
22502297
self: Series[float],
@@ -2255,41 +2302,41 @@ class Series(IndexOpsMixin[S1], NDFrame):
22552302
self: Series[float], other: _T_COMPLEX | Sequence[_T_COMPLEX]
22562303
) -> Series[_T_COMPLEX]: ...
22572304
@overload
2258-
def __rtruediv__(
2259-
self: Series[float], other: np_ndarray_complex
2260-
) -> Series[complex]: ...
2261-
@overload
22622305
def __rtruediv__(
22632306
self: Series[complex],
22642307
other: (
22652308
_T_COMPLEX
22662309
| Sequence[_T_COMPLEX]
2310+
| np_ndarray_bool
22672311
| np_ndarray_anyint
22682312
| np_ndarray_float
2269-
| np_ndarray_complex
22702313
),
22712314
) -> Series[complex]: ...
22722315
@overload
2316+
def __rtruediv__(
2317+
self: Series[_T_COMPLEX], other: np_ndarray_complex
2318+
) -> Series[complex]: ...
2319+
@overload
22732320
def __rtruediv__(self, other: Path) -> Series: ...
22742321
@overload
22752322
def rtruediv(
22762323
self: Series[Never],
2277-
other: Scalar | _ListLike | Series,
2324+
other: complex | _ListLike | Series,
22782325
level: Level | None = None,
22792326
fill_value: float | None = None,
22802327
axis: AxisIndex = 0,
22812328
) -> Series: ...
22822329
@overload
22832330
def rtruediv(
2284-
self: Series[int],
2331+
self: Series[bool],
22852332
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
22862333
level: Level | None = None,
22872334
fill_value: float | None = None,
22882335
axis: AxisIndex = 0,
22892336
) -> Series[float]: ...
22902337
@overload
22912338
def rtruediv(
2292-
self: Series[int],
2339+
self: Series[bool],
22932340
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
22942341
level: Level | None = None,
22952342
fill_value: float | None = None,
@@ -2298,51 +2345,66 @@ class Series(IndexOpsMixin[S1], NDFrame):
22982345
@overload
22992346
def rtruediv(
23002347
self: Series[int],
2301-
other: np_ndarray_complex,
2348+
other: (
2349+
_T_INT
2350+
| Sequence[_T_INT]
2351+
| np_ndarray_bool
2352+
| np_ndarray_anyint
2353+
| np_ndarray_float
2354+
| Series[_T_INT]
2355+
),
23022356
level: Level | None = None,
23032357
fill_value: float | None = None,
23042358
axis: AxisIndex = 0,
2305-
) -> Series[complex]: ...
2359+
) -> Series[float]: ...
23062360
@overload
23072361
def rtruediv(
2308-
self: Series[float],
2309-
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
2362+
self: Series[int],
2363+
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
23102364
level: Level | None = None,
23112365
fill_value: float | None = None,
23122366
axis: AxisIndex = 0,
2313-
) -> Series[float]: ...
2367+
) -> Series[_T_COMPLEX]: ...
23142368
@overload
23152369
def rtruediv(
23162370
self: Series[float],
2317-
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
2371+
other: int | Sequence[int] | np_ndarray_anyint | np_ndarray_float | Series[int],
23182372
level: Level | None = None,
23192373
fill_value: float | None = None,
23202374
axis: AxisIndex = 0,
2321-
) -> Series[_T_COMPLEX]: ...
2375+
) -> Series[float]: ...
23222376
@overload
23232377
def rtruediv(
23242378
self: Series[float],
2325-
other: np_ndarray_complex,
2379+
other: _T_COMPLEX | Sequence[_T_COMPLEX] | Series[_T_COMPLEX],
23262380
level: Level | None = None,
23272381
fill_value: float | None = None,
23282382
axis: AxisIndex = 0,
2329-
) -> Series[complex]: ...
2383+
) -> Series[_T_COMPLEX]: ...
23302384
@overload
23312385
def rtruediv(
23322386
self: Series[complex],
23332387
other: (
23342388
_T_COMPLEX
23352389
| Sequence[_T_COMPLEX]
2390+
| np_ndarray_bool
23362391
| np_ndarray_anyint
23372392
| np_ndarray_float
2338-
| np_ndarray_complex
23392393
| Series[_T_COMPLEX]
23402394
),
23412395
level: Level | None = None,
23422396
fill_value: float | None = None,
23432397
axis: AxisIndex = 0,
23442398
) -> Series[complex]: ...
23452399
@overload
2400+
def rtruediv(
2401+
self: Series[_T_COMPLEX],
2402+
other: np_ndarray_complex,
2403+
level: Level | None = None,
2404+
fill_value: float | None = None,
2405+
axis: AxisIndex = 0,
2406+
) -> Series[complex]: ...
2407+
@overload
23462408
def rtruediv(
23472409
self,
23482410
other: Path,

0 commit comments

Comments
 (0)