File tree 3 files changed +10
-0
lines changed
3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -214,6 +214,7 @@ API Changes
214
214
data - allowing metadata changes.
215
215
- ``MultiIndex.astype() `` now only allows ``np.object_ ``-like dtypes and
216
216
now returns a ``MultiIndex `` rather than an ``Index ``. (:issue: `4039 `)
217
+ - Aliased ``__iadd__ `` to ``__add__ ``. (:issue: `4996 `)
217
218
- Added ``is_ `` method to ``Index `` that allows fast equality comparison of
218
219
views (similar to ``np.may_share_memory `` but no false positives, and
219
220
changes on ``levels `` and ``labels `` setting on ``MultiIndex ``).
Original file line number Diff line number Diff line change @@ -832,6 +832,7 @@ def __add__(self, other):
832
832
else :
833
833
return Index (self .view (np .ndarray ) + other )
834
834
835
+ __iadd__ = __add__
835
836
__eq__ = _indexOp ('__eq__' )
836
837
__ne__ = _indexOp ('__ne__' )
837
838
__lt__ = _indexOp ('__lt__' )
Original file line number Diff line number Diff line change @@ -382,6 +382,14 @@ def test_add_string(self):
382
382
self .assert_ ('a' not in index2 )
383
383
self .assert_ ('afoo' in index2 )
384
384
385
+ def test_iadd_string (self ):
386
+ index = pd .Index (['a' , 'b' , 'c' ])
387
+ # doesn't fail test unless there is a check before `+=`
388
+ self .assert_ ('a' in index )
389
+
390
+ index += '_x'
391
+ self .assert_ ('a_x' in index )
392
+
385
393
def test_diff (self ):
386
394
first = self .strIndex [5 :20 ]
387
395
second = self .strIndex [:10 ]
You can’t perform that action at this time.
0 commit comments