@@ -176,6 +176,7 @@ from pandas._typing import (
176176 VoidDtypeArg ,
177177 WriteBuffer ,
178178 np_ndarray_anyint ,
179+ np_ndarray_bool ,
179180 np_ndarray_complex ,
180181 np_ndarray_float ,
181182 npt ,
@@ -187,6 +188,7 @@ from pandas.core.dtypes.dtypes import CategoricalDtype
187188
188189from pandas .plotting import PlotAccessor
189190
191+ _T_INT = TypeVar ("_T_INT" , bound = int )
190192_T_COMPLEX = TypeVar ("_T_COMPLEX" , bound = complex )
191193
192194class _iLocIndexerSeries (_iLocIndexer , Generic [S1 ]):
@@ -1619,18 +1621,44 @@ class Series(IndexOpsMixin[S1], NDFrame):
16191621 def __add__ (self , other : Series [Never ]) -> Series : ...
16201622 @overload
16211623 def __add__ (
1622- self : Series [int ], other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ]
1624+ self : Series [bool ],
1625+ other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
16231626 ) -> Series [_T_COMPLEX ]: ...
16241627 @overload
1625- def __add__ (self : Series [int ], other : np_ndarray_anyint ) -> Series [int ]: ...
1628+ def __add__ (self : Series [bool ], other : np_ndarray_bool ) -> Series [bool ]: ...
1629+ @overload
1630+ def __add__ (self : Series [bool ], other : np_ndarray_anyint ) -> Series [int ]: ...
1631+ @overload
1632+ def __add__ (self : Series [bool ], other : np_ndarray_float ) -> Series [float ]: ...
1633+ @overload
1634+ def __add__ (self : Series [bool ], other : np_ndarray_complex ) -> Series [complex ]: ...
1635+ @overload
1636+ def __add__ (
1637+ self : Series [int ],
1638+ other : (
1639+ bool | Sequence [bool ] | np_ndarray_bool | np_ndarray_anyint | Series [bool ]
1640+ ),
1641+ ) -> Series [int ]: ...
1642+ @overload
1643+ def __add__ (
1644+ self : Series [int ],
1645+ other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
1646+ ) -> Series [_T_COMPLEX ]: ...
16261647 @overload
16271648 def __add__ (self : Series [int ], other : np_ndarray_float ) -> Series [float ]: ...
16281649 @overload
16291650 def __add__ (self : Series [int ], other : np_ndarray_complex ) -> Series [complex ]: ...
16301651 @overload
16311652 def __add__ (
16321653 self : Series [float ],
1633- other : int | Sequence [int ] | np_ndarray_anyint | np_ndarray_float | Series [int ],
1654+ other : (
1655+ _T_INT
1656+ | Sequence [_T_INT ]
1657+ | np_ndarray_bool
1658+ | np_ndarray_anyint
1659+ | np_ndarray_float
1660+ | Series [_T_INT ]
1661+ ),
16341662 ) -> Series [float ]: ...
16351663 @overload
16361664 def __add__ (
@@ -1643,12 +1671,12 @@ class Series(IndexOpsMixin[S1], NDFrame):
16431671 def __add__ (
16441672 self : Series [complex ],
16451673 other : (
1646- _T_COMPLEX
1647- | Sequence [_T_COMPLEX ]
1648- | Series [_T_COMPLEX ]
1674+ Sequence [_T_COMPLEX ]
1675+ | np_ndarray_bool
16491676 | np_ndarray_anyint
16501677 | np_ndarray_float
16511678 | np_ndarray_complex
1679+ | Series [_T_COMPLEX ]
16521680 ),
16531681 ) -> Series [complex ]: ...
16541682 @overload
@@ -1663,21 +1691,63 @@ class Series(IndexOpsMixin[S1], NDFrame):
16631691 ) -> Series : ...
16641692 @overload
16651693 def add (
1666- self : Series [int ],
1694+ self : Series [bool ],
16671695 other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
16681696 level : Level | None = None ,
16691697 fill_value : float | None = None ,
16701698 axis : int = 0 ,
16711699 ) -> Series [_T_COMPLEX ]: ...
16721700 @overload
16731701 def add (
1674- self : Series [int ],
1702+ self : Series [bool ],
1703+ other : np_ndarray_bool ,
1704+ level : Level | None = None ,
1705+ fill_value : float | None = None ,
1706+ axis : int = 0 ,
1707+ ) -> Series [bool ]: ...
1708+ @overload
1709+ def add (
1710+ self : Series [bool ],
16751711 other : np_ndarray_anyint ,
16761712 level : Level | None = None ,
16771713 fill_value : float | None = None ,
16781714 axis : int = 0 ,
16791715 ) -> Series [int ]: ...
16801716 @overload
1717+ def add (
1718+ self : Series [bool ],
1719+ other : np_ndarray_float ,
1720+ level : Level | None = None ,
1721+ fill_value : float | None = None ,
1722+ axis : int = 0 ,
1723+ ) -> Series [float ]: ...
1724+ @overload
1725+ def add (
1726+ self : Series [bool ],
1727+ other : np_ndarray_complex ,
1728+ level : Level | None = None ,
1729+ fill_value : float | None = None ,
1730+ axis : int = 0 ,
1731+ ) -> Series [complex ]: ...
1732+ @overload
1733+ def add (
1734+ self : Series [int ],
1735+ other : (
1736+ bool | Sequence [bool ] | np_ndarray_bool | np_ndarray_anyint | Series [bool ]
1737+ ),
1738+ level : Level | None = None ,
1739+ fill_value : float | None = None ,
1740+ axis : int = 0 ,
1741+ ) -> Series [int ]: ...
1742+ @overload
1743+ def add (
1744+ self : Series [int ],
1745+ other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
1746+ level : Level | None = None ,
1747+ fill_value : float | None = None ,
1748+ axis : int = 0 ,
1749+ ) -> Series [_T_COMPLEX ]: ...
1750+ @overload
16811751 def add (
16821752 self : Series [int ],
16831753 other : np_ndarray_float ,
@@ -1696,7 +1766,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
16961766 @overload
16971767 def add (
16981768 self : Series [float ],
1699- other : int | Sequence [int ] | np_ndarray_anyint | np_ndarray_float | Series [int ],
1769+ other : (
1770+ _T_INT
1771+ | Sequence [_T_INT ]
1772+ | np_ndarray_bool
1773+ | np_ndarray_anyint
1774+ | np_ndarray_float
1775+ | Series [_T_INT ]
1776+ ),
17001777 level : Level | None = None ,
17011778 fill_value : float | None = None ,
17021779 axis : int = 0 ,
@@ -1722,6 +1799,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
17221799 self : Series [complex ],
17231800 other : (
17241801 Sequence [_T_COMPLEX ]
1802+ | np_ndarray_bool
17251803 | np_ndarray_anyint
17261804 | np_ndarray_float
17271805 | np_ndarray_complex
@@ -1743,18 +1821,39 @@ class Series(IndexOpsMixin[S1], NDFrame):
17431821 def __radd__ (self : Series [Never ], other : Scalar | _ListLike ) -> Series : ...
17441822 @overload
17451823 def __radd__ (
1746- self : Series [int ], other : _T_COMPLEX | Sequence [_T_COMPLEX ]
1824+ self : Series [bool ], other : _T_COMPLEX | Sequence [_T_COMPLEX ]
17471825 ) -> Series [_T_COMPLEX ]: ...
17481826 @overload
1749- def __radd__ (self : Series [int ], other : np_ndarray_anyint ) -> Series [int ]: ...
1827+ def __radd__ (self : Series [bool ], other : np_ndarray_bool ) -> Series [bool ]: ...
1828+ @overload
1829+ def __radd__ (self : Series [bool ], other : np_ndarray_anyint ) -> Series [int ]: ...
1830+ @overload
1831+ def __radd__ (self : Series [bool ], other : np_ndarray_float ) -> Series [float ]: ...
1832+ @overload
1833+ def __radd__ (self : Series [bool ], other : np_ndarray_complex ) -> Series [complex ]: ...
1834+ @overload
1835+ def __radd__ (
1836+ self : Series [int ],
1837+ other : bool | Sequence [bool ] | np_ndarray_bool | np_ndarray_anyint ,
1838+ ) -> Series [int ]: ...
1839+ @overload
1840+ def __radd__ (
1841+ self : Series [int ], other : _T_COMPLEX | Sequence [_T_COMPLEX ]
1842+ ) -> Series [_T_COMPLEX ]: ...
17501843 @overload
17511844 def __radd__ (self : Series [int ], other : np_ndarray_float ) -> Series [float ]: ...
17521845 @overload
17531846 def __radd__ (self : Series [int ], other : np_ndarray_complex ) -> Series [complex ]: ...
17541847 @overload
17551848 def __radd__ (
17561849 self : Series [float ],
1757- other : int | Sequence [int ] | np_ndarray_anyint | np_ndarray_float ,
1850+ other : (
1851+ _T_INT
1852+ | Sequence [_T_INT ]
1853+ | np_ndarray_bool
1854+ | np_ndarray_anyint
1855+ | np_ndarray_float
1856+ ),
17581857 ) -> Series [float ]: ...
17591858 @overload
17601859 def __radd__ (
@@ -1766,7 +1865,8 @@ class Series(IndexOpsMixin[S1], NDFrame):
17661865 def __radd__ (
17671866 self : Series [complex ],
17681867 other : (
1769- np_ndarray_anyint
1868+ np_ndarray_bool
1869+ | np_ndarray_anyint
17701870 | np_ndarray_float
17711871 | np_ndarray_complex
17721872 | Sequence [_T_COMPLEX ]
@@ -1784,21 +1884,63 @@ class Series(IndexOpsMixin[S1], NDFrame):
17841884 ) -> Series : ...
17851885 @overload
17861886 def radd (
1787- self : Series [int ],
1887+ self : Series [bool ],
17881888 other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
17891889 level : Level | None = None ,
17901890 fill_value : float | None = None ,
17911891 axis : int = 0 ,
17921892 ) -> Series [_T_COMPLEX ]: ...
17931893 @overload
17941894 def radd (
1795- self : Series [int ],
1895+ self : Series [bool ],
1896+ other : np_ndarray_bool ,
1897+ level : Level | None = None ,
1898+ fill_value : float | None = None ,
1899+ axis : int = 0 ,
1900+ ) -> Series [bool ]: ...
1901+ @overload
1902+ def radd (
1903+ self : Series [bool ],
17961904 other : np_ndarray_anyint ,
17971905 level : Level | None = None ,
17981906 fill_value : float | None = None ,
17991907 axis : int = 0 ,
18001908 ) -> Series [int ]: ...
18011909 @overload
1910+ def radd (
1911+ self : Series [bool ],
1912+ other : np_ndarray_float ,
1913+ level : Level | None = None ,
1914+ fill_value : float | None = None ,
1915+ axis : int = 0 ,
1916+ ) -> Series [float ]: ...
1917+ @overload
1918+ def radd (
1919+ self : Series [bool ],
1920+ other : np_ndarray_complex ,
1921+ level : Level | None = None ,
1922+ fill_value : float | None = None ,
1923+ axis : int = 0 ,
1924+ ) -> Series [complex ]: ...
1925+ @overload
1926+ def radd (
1927+ self : Series [int ],
1928+ other : (
1929+ bool | Sequence [bool ] | np_ndarray_bool | np_ndarray_anyint | Series [bool ]
1930+ ),
1931+ level : Level | None = None ,
1932+ fill_value : float | None = None ,
1933+ axis : int = 0 ,
1934+ ) -> Series [int ]: ...
1935+ @overload
1936+ def radd (
1937+ self : Series [int ],
1938+ other : _T_COMPLEX | Sequence [_T_COMPLEX ] | Series [_T_COMPLEX ],
1939+ level : Level | None = None ,
1940+ fill_value : float | None = None ,
1941+ axis : int = 0 ,
1942+ ) -> Series [_T_COMPLEX ]: ...
1943+ @overload
18021944 def radd (
18031945 self : Series [int ],
18041946 other : np_ndarray_float ,
@@ -1817,7 +1959,14 @@ class Series(IndexOpsMixin[S1], NDFrame):
18171959 @overload
18181960 def radd (
18191961 self : Series [float ],
1820- other : int | Sequence [int ] | np_ndarray_anyint | np_ndarray_float | Series [int ],
1962+ other : (
1963+ _T_INT
1964+ | Sequence [_T_INT ]
1965+ | np_ndarray_bool
1966+ | np_ndarray_anyint
1967+ | np_ndarray_float
1968+ | Series [_T_INT ]
1969+ ),
18211970 level : Level | None = None ,
18221971 fill_value : float | None = None ,
18231972 axis : int = 0 ,
@@ -1843,6 +1992,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
18431992 self : Series [complex ],
18441993 other : (
18451994 Sequence [_T_COMPLEX ]
1995+ | np_ndarray_bool
18461996 | np_ndarray_anyint
18471997 | np_ndarray_float
18481998 | np_ndarray_complex
0 commit comments