Skip to content

Commit 40ff9bc

Browse files
committed
Merge branch 'iadd' of https://github.com/d10genes/pandas into d10genes-iadd
Conflicts: doc/source/release.rst
2 parents d7e4fd3 + c66a5fd commit 40ff9bc

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

doc/source/release.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Improvements to existing features
161161
:issue:`4998`)
162162
- ``to_dict`` now takes ``records`` as a possible outtype. Returns an array
163163
of column-keyed dictionaries. (:issue:`4936`)
164-
- ``tz_localize`` can infer a fall daylight savings transition based on the
164+
- ``tz_localize`` can infer a fall daylight savings transition based on the
165165
structure of unlocalized data (:issue:`4230`)
166166
- DatetimeIndex is now in the API documentation
167167

@@ -244,6 +244,12 @@ API Changes
244244
views (similar to ``np.may_share_memory`` but no false positives, and
245245
changes on ``levels`` and ``labels`` setting on ``MultiIndex``).
246246
(:issue:`4859` , :issue:`4909`)
247+
- Aliased ``__iadd__`` to ``__add__``. (:issue:`4996`)
248+
- Added ``is_`` method to ``Index`` that allows fast equality comparison of
249+
views (similar to ``np.may_share_memory`` but no false positives, and
250+
changes on ``levels`` and ``labels`` setting on ``MultiIndex``).
251+
(:issue:`4859`, :issue:`4909`)
252+
247253
- Infer and downcast dtype if ``downcast='infer'`` is passed to ``fillna/ffill/bfill`` (:issue:`4604`)
248254
- ``__nonzero__`` for all NDFrame objects, will now raise a ``ValueError``, this reverts back to (:issue:`1073`, :issue:`4633`)
249255
behavior. Add ``.bool()`` method to ``NDFrame`` objects to facilitate evaluating of single-element boolean Series

pandas/core/index.py

+1
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ def __add__(self, other):
833833
else:
834834
return Index(self.view(np.ndarray) + other)
835835

836+
__iadd__ = __add__
836837
__eq__ = _indexOp('__eq__')
837838
__ne__ = _indexOp('__ne__')
838839
__lt__ = _indexOp('__lt__')

pandas/tests/test_index.py

+8
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,14 @@ def test_add_string(self):
407407
self.assert_('a' not in index2)
408408
self.assert_('afoo' in index2)
409409

410+
def test_iadd_string(self):
411+
index = pd.Index(['a', 'b', 'c'])
412+
# doesn't fail test unless there is a check before `+=`
413+
self.assert_('a' in index)
414+
415+
index += '_x'
416+
self.assert_('a_x' in index)
417+
410418
def test_diff(self):
411419
first = self.strIndex[5:20]
412420
second = self.strIndex[:10]

0 commit comments

Comments
 (0)