@@ -150,22 +150,7 @@ def names(x):
150150 return new_methods
151151
152152
153- def add_methods (cls , new_methods , force , select , exclude ):
154- if select and exclude :
155- raise TypeError ("May only pass either select or exclude" )
156-
157- if select :
158- select = set (select )
159- methods = {}
160- for key , method in new_methods .items ():
161- if key in select :
162- methods [key ] = method
163- new_methods = methods
164-
165- if exclude :
166- for k in exclude :
167- new_methods .pop (k , None )
168-
153+ def add_methods (cls , new_methods , force ):
169154 for name , method in new_methods .items ():
170155 if force or name not in cls .__dict__ :
171156 bind_method (cls , name , method )
@@ -175,8 +160,8 @@ def add_methods(cls, new_methods, force, select, exclude):
175160# Arithmetic
176161def add_special_arithmetic_methods (cls , arith_method = None ,
177162 comp_method = None , bool_method = None ,
178- use_numexpr = True , force = False , select = None ,
179- exclude = None , have_divmod = False ):
163+ use_numexpr = True , force = False ,
164+ have_divmod = False ):
180165 """
181166 Adds the full suite of special arithmetic methods (``__add__``,
182167 ``__sub__``, etc.) to the class.
@@ -195,10 +180,6 @@ def add_special_arithmetic_methods(cls, arith_method=None,
195180 force : bool, default False
196181 if False, checks whether function is defined **on ``cls.__dict__``**
197182 before defining if True, always defines functions on class base
198- select : iterable of strings (optional)
199- if passed, only sets functions with names in select
200- exclude : iterable of strings (optional)
201- if passed, will not set functions with names in exclude
202183 have_divmod : bool, (optional)
203184 should a divmod method be added? this method is special because it
204185 returns a tuple of cls instead of a single element of type cls
@@ -247,14 +228,12 @@ def f(self, other):
247228 __ior__ = _wrap_inplace_method (new_methods ["__or__" ]),
248229 __ixor__ = _wrap_inplace_method (new_methods ["__xor__" ])))
249230
250- add_methods (cls , new_methods = new_methods , force = force , select = select ,
251- exclude = exclude )
231+ add_methods (cls , new_methods = new_methods , force = force )
252232
253233
254234def add_flex_arithmetic_methods (cls , flex_arith_method ,
255235 flex_comp_method = None , flex_bool_method = None ,
256- use_numexpr = True , force = False , select = None ,
257- exclude = None ):
236+ use_numexpr = True , force = False ):
258237 """
259238 Adds the full suite of flex arithmetic methods (``pow``, ``mul``, ``add``)
260239 to the class.
@@ -271,10 +250,6 @@ def add_flex_arithmetic_methods(cls, flex_arith_method,
271250 force : bool, default False
272251 if False, checks whether function is defined **on ``cls.__dict__``**
273252 before defining if True, always defines functions on class base
274- select : iterable of strings (optional)
275- if passed, only sets functions with names in select
276- exclude : iterable of strings (optional)
277- if passed, will not set functions with names in exclude
278253 """
279254 # in frame, default axis is 'columns', doesn't matter for series and panel
280255 new_methods = _create_methods (flex_arith_method ,
@@ -289,8 +264,7 @@ def add_flex_arithmetic_methods(cls, flex_arith_method,
289264 if k in new_methods :
290265 new_methods .pop (k )
291266
292- add_methods (cls , new_methods = new_methods , force = force , select = select ,
293- exclude = exclude )
267+ add_methods (cls , new_methods = new_methods , force = force )
294268
295269
296270def _align_method_SERIES (left , right , align_asobject = False ):
@@ -389,16 +363,16 @@ def wrapper(left, right, name=name, na_op=na_op):
389363 return NotImplemented
390364
391365 left , right = _align_method_SERIES (left , right )
366+ res_name = _get_series_op_result_name (left , right )
367+
392368 if is_datetime64_dtype (left ) or is_datetime64tz_dtype (left ):
393369 result = dispatch_to_index_op (op , left , right , pd .DatetimeIndex )
394- res_name = _get_series_op_result_name (left , right )
395370 return construct_result (left , result ,
396371 index = left .index , name = res_name ,
397372 dtype = result .dtype )
398373
399374 elif is_timedelta64_dtype (left ):
400375 result = dispatch_to_index_op (op , left , right , pd .TimedeltaIndex )
401- res_name = _get_series_op_result_name (left , right )
402376 return construct_result (left , result ,
403377 index = left .index , name = res_name ,
404378 dtype = result .dtype )
@@ -409,7 +383,6 @@ def wrapper(left, right, name=name, na_op=na_op):
409383 rvalues = getattr (rvalues , 'values' , rvalues )
410384
411385 result = safe_na_op (lvalues , rvalues )
412- res_name = _get_series_op_result_name (left , right )
413386 return construct_result (left , result ,
414387 index = left .index , name = res_name , dtype = None )
415388
0 commit comments