@@ -1739,28 +1739,16 @@ def argsort(self, *args, **kwargs):
1739
1739
return result .argsort (* args , ** kwargs )
1740
1740
1741
1741
def __add__ (self , other ):
1742
- if is_list_like (other ):
1743
- warnings .warn ("using '+' to provide set union with Indexes is "
1744
- "deprecated, use '|' or .union()" , FutureWarning ,
1745
- stacklevel = 2 )
1746
- if isinstance (other , Index ):
1747
- return self .union (other )
1748
1742
return Index (np .array (self ) + other )
1749
1743
1750
1744
def __radd__ (self , other ):
1751
- if is_list_like (other ):
1752
- warnings .warn ("using '+' to provide set union with Indexes is "
1753
- "deprecated, use '|' or .union()" , FutureWarning ,
1754
- stacklevel = 2 )
1755
1745
return Index (other + np .array (self ))
1756
1746
1757
1747
__iadd__ = __add__
1758
1748
1759
1749
def __sub__ (self , other ):
1760
- warnings .warn ("using '-' to provide set differences with Indexes is "
1761
- "deprecated, use .difference()" , FutureWarning ,
1762
- stacklevel = 2 )
1763
- return self .difference (other )
1750
+ raise TypeError ("cannot perform __sub__ with this index type: "
1751
+ "{typ}" .format (typ = type (self )))
1764
1752
1765
1753
def __and__ (self , other ):
1766
1754
return self .intersection (other )
@@ -1990,7 +1978,8 @@ def symmetric_difference(self, other, result_name=None):
1990
1978
-----
1991
1979
``symmetric_difference`` contains elements that appear in either
1992
1980
``idx1`` or ``idx2`` but not both. Equivalent to the Index created by
1993
- ``(idx1 - idx2) + (idx2 - idx1)`` with duplicates dropped.
1981
+ ``idx1.difference(idx2) | idx2.difference(idx1)`` with duplicates
1982
+ dropped.
1994
1983
1995
1984
Examples
1996
1985
--------
@@ -3333,8 +3322,8 @@ def _evaluate_compare(self, other):
3333
3322
cls .__ge__ = _make_compare (operator .ge )
3334
3323
3335
3324
@classmethod
3336
- def _add_numericlike_set_methods_disabled (cls ):
3337
- """ add in the numeric set-like methods to disable """
3325
+ def _add_numeric_methods_add_sub_disabled (cls ):
3326
+ """ add in the numeric add/sub methods to disable """
3338
3327
3339
3328
def _make_invalid_op (name ):
3340
3329
def invalid_op (self , other = None ):
@@ -3349,7 +3338,7 @@ def invalid_op(self, other=None):
3349
3338
3350
3339
@classmethod
3351
3340
def _add_numeric_methods_disabled (cls ):
3352
- """ add in numeric methods to disable """
3341
+ """ add in numeric methods to disable other than add/sub """
3353
3342
3354
3343
def _make_invalid_op (name ):
3355
3344
def invalid_op (self , other = None ):
0 commit comments