@@ -9799,6 +9799,7 @@ def _tz_localize(ax, tz, ambiguous, nonexistent):
9799
9799
9800
9800
# ----------------------------------------------------------------------
9801
9801
# Numeric Methods
9802
+
9802
9803
def abs (self : FrameOrSeries ) -> FrameOrSeries :
9803
9804
"""
9804
9805
Return a Series/DataFrame with absolute numeric value of each element.
@@ -11088,6 +11089,55 @@ def ewm(
11088
11089
times = times ,
11089
11090
)
11090
11091
11092
+ # ----------------------------------------------------------------------
11093
+ # Arithmetic Methods
11094
+
11095
+ def _inplace_method (self , other , op ):
11096
+ """
11097
+ Wrap arithmetic method to operate inplace.
11098
+ """
11099
+ result = op (self , other )
11100
+
11101
+ # Delete cacher
11102
+ self ._reset_cacher ()
11103
+
11104
+ # this makes sure that we are aligned like the input
11105
+ # we are updating inplace so we want to ignore is_copy
11106
+ self ._update_inplace (
11107
+ result .reindex_like (self , copy = False ), verify_is_copy = False
11108
+ )
11109
+ return self
11110
+
11111
+ def __iadd__ (self , other ):
11112
+ return self ._inplace_method (other , type (self ).__add__ )
11113
+
11114
+ def __isub__ (self , other ):
11115
+ return self ._inplace_method (other , type (self ).__sub__ )
11116
+
11117
+ def __imul__ (self , other ):
11118
+ return self ._inplace_method (other , type (self ).__mul__ )
11119
+
11120
+ def __itruediv__ (self , other ):
11121
+ return self ._inplace_method (other , type (self ).__truediv__ )
11122
+
11123
+ def __ifloordiv__ (self , other ):
11124
+ return self ._inplace_method (other , type (self ).__floordiv__ )
11125
+
11126
+ def __imod__ (self , other ):
11127
+ return self ._inplace_method (other , type (self ).__mod__ )
11128
+
11129
+ def __ipow__ (self , other ):
11130
+ return self ._inplace_method (other , type (self ).__pow__ )
11131
+
11132
+ def __iand__ (self , other ):
11133
+ return self ._inplace_method (other , type (self ).__and__ )
11134
+
11135
+ def __ior__ (self , other ):
11136
+ return self ._inplace_method (other , type (self ).__or__ )
11137
+
11138
+ def __ixor__ (self , other ):
11139
+ return self ._inplace_method (other , type (self ).__xor__ )
11140
+
11091
11141
# ----------------------------------------------------------------------
11092
11142
# Misc methods
11093
11143
0 commit comments