@@ -83,48 +83,6 @@ def add_special_arithmetic_methods(cls):
83
83
new_methods = _create_methods (
84
84
cls , arith_method , comp_method , bool_method , special = True
85
85
)
86
- # inplace operators (I feel like these should get passed an `inplace=True`
87
- # or just be removed
88
-
89
- def _wrap_inplace_method (method ):
90
- """
91
- return an inplace wrapper for this method
92
- """
93
-
94
- def f (self , other ):
95
- result = method (self , other )
96
-
97
- # this makes sure that we are aligned like the input
98
- # we are updating inplace so we want to ignore is_copy
99
- self ._update_inplace (
100
- result .reindex_like (self , copy = False )._data , verify_is_copy = False
101
- )
102
-
103
- return self
104
-
105
- f .__name__ = "__i{name}__" .format (name = method .__name__ .strip ("__" ))
106
- return f
107
-
108
- new_methods .update (
109
- dict (
110
- __iadd__ = _wrap_inplace_method (new_methods ["__add__" ]),
111
- __isub__ = _wrap_inplace_method (new_methods ["__sub__" ]),
112
- __imul__ = _wrap_inplace_method (new_methods ["__mul__" ]),
113
- __itruediv__ = _wrap_inplace_method (new_methods ["__truediv__" ]),
114
- __ifloordiv__ = _wrap_inplace_method (new_methods ["__floordiv__" ]),
115
- __imod__ = _wrap_inplace_method (new_methods ["__mod__" ]),
116
- __ipow__ = _wrap_inplace_method (new_methods ["__pow__" ]),
117
- )
118
- )
119
-
120
- new_methods .update (
121
- dict (
122
- __iand__ = _wrap_inplace_method (new_methods ["__and__" ]),
123
- __ior__ = _wrap_inplace_method (new_methods ["__or__" ]),
124
- __ixor__ = _wrap_inplace_method (new_methods ["__xor__" ]),
125
- )
126
- )
127
-
128
86
_add_methods (cls , new_methods = new_methods )
129
87
130
88
0 commit comments