Skip to content

Commit 1b0ed87

Browse files
committed
Merge pull request #6284 from TomAugspurger/interpolate-inplace
BUG: Fix interpolate with inplace=True
2 parents c7e3058 + b8c01a3 commit 1b0ed87

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

doc/source/release.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Bug Fixes
7777
- Bug in ``.xs`` with a Series multiindex (:issue:`6258`, :issue:`5684`)
7878
- Bug in conversion of a string types to a DatetimeIndex with a specified frequency (:issue:`6273`, :issue:`6274`)
7979
- Bug in ``eval`` where type-promotion failed for large expressions (:issue:`6205`)
80+
- Bug in interpolate with inplace=True (:issue:`6281`)
8081

8182
pandas 0.13.1
8283
-------------

pandas/core/generic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,9 +2541,9 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
25412541
self._update_inplace(new_data)
25422542
else:
25432543
res = self._constructor(new_data).__finalize__(self)
2544-
if axis == 1:
2545-
res = res.T
2546-
return res
2544+
if axis == 1:
2545+
res = res.T
2546+
return res
25472547

25482548
#----------------------------------------------------------------------
25492549
# Action Methods

pandas/tests/test_generic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,12 @@ def test_interp_raise_on_only_mixed(self):
784784
with tm.assertRaises(TypeError):
785785
df.interpolate(axis=1)
786786

787+
def test_interp_inplace(self):
788+
df = DataFrame({'a': [1., 2., np.nan, 4.]})
789+
expected = DataFrame({'a': [1, 2, 3, 4]})
790+
df['a'].interpolate(inplace=True)
791+
assert_frame_equal(df, expected)
792+
787793
def test_no_order(self):
788794
_skip_if_no_scipy()
789795
s = Series([0, 1, np.nan, 3])

0 commit comments

Comments
 (0)