Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pandas-stubs/core/arraylike.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class OpsMixin:
def __rxor__(self, other: Any) -> Self: ...
# -------------------------------------------------------------
# Arithmetic Methods
def __add__(self, other: Any) -> Self: ...
def __radd__(self, other: Any) -> Self: ...
def __sub__(self, other: Any) -> Self: ...
def __rsub__(self, other: Any) -> Self: ...
def __mul__(self, other: Any) -> Self: ...
Expand Down
16 changes: 9 additions & 7 deletions pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1772,13 +1772,22 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
# methods
@final
def abs(self) -> Self: ...
def __add__(self, other: Any) -> Self: ...
def add(
self,
other: num | ListLike | DataFrame,
axis: Axis | None = "columns",
level: Level | None = None,
fill_value: float | None = None,
) -> Self: ...
def __radd__(self, other: Any) -> Self: ...
def radd(
self,
other,
axis: Axis = "columns",
level: Level | None = None,
fill_value: float | None = None,
) -> Self: ...
@final
def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Self: ...
@final
Expand Down Expand Up @@ -2222,13 +2231,6 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
min_count: int = 0,
**kwargs: Any,
) -> Series: ...
def radd(
self,
other,
axis: Axis = "columns",
level: Level | None = None,
fill_value: float | None = None,
) -> Self: ...
@final
def rank(
self,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/indexes/base.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ class Index(IndexOpsMixin[S1]):
def __add__(
self: Index[_str], other: _str | Sequence[_str] | np_ndarray_str | Index[_str]
) -> Index[_str]: ...
@overload # type: ignore[override]
@overload
def __radd__(self: Index[Never], other: _str) -> Never: ...
@overload
def __radd__(self: Index[Never], other: complex | _ListLike | Index) -> Index: ...
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/series.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
fill_value: float | None = None,
axis: int = 0,
) -> Series[_str]: ...
@overload # type: ignore[override]
@overload
def __radd__(self: Series[Never], other: _str) -> Never: ...
@overload
def __radd__(
Expand Down
2 changes: 0 additions & 2 deletions tests/indexes/test_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,10 @@ def test_types_to_numpy() -> None:
def test_index_arithmetic() -> None:
# GH 287
idx = pd.Index([1, 2.2, 3], dtype=float)
check(assert_type(idx + 3, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(idx - 3, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(idx * 3, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(idx / 3, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(idx // 3, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(3 + idx, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(3 - idx, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(3 * idx, "pd.Index[float]"), pd.Index, np.float64)
check(assert_type(3 / idx, "pd.Index[float]"), pd.Index, np.float64)
Expand Down
Loading