Skip to content

BUG: Fix interpolate with inplace=True #6284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Bug Fixes
- Bug in ``.xs`` with a Series multiindex (:issue:`6258`, :issue:`5684`)
- Bug in conversion of a string types to a DatetimeIndex with a specified frequency (:issue:`6273`, :issue:`6274`)
- Bug in ``eval`` where type-promotion failed for large expressions (:issue:`6205`)
- Bug in interpolate with inplace=True (:issue:`6281`)

pandas 0.13.1
-------------
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2541,9 +2541,9 @@ def interpolate(self, method='linear', axis=0, limit=None, inplace=False,
self._update_inplace(new_data)
else:
res = self._constructor(new_data).__finalize__(self)
if axis == 1:
res = res.T
return res
if axis == 1:
res = res.T
return res

#----------------------------------------------------------------------
# Action Methods
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,12 @@ def test_interp_raise_on_only_mixed(self):
with tm.assertRaises(TypeError):
df.interpolate(axis=1)

def test_interp_inplace(self):
df = DataFrame({'a': [1., 2., np.nan, 4.]})
expected = DataFrame({'a': [1, 2, 3, 4]})
df['a'].interpolate(inplace=True)
assert_frame_equal(df, expected)

def test_no_order(self):
_skip_if_no_scipy()
s = Series([0, 1, np.nan, 3])
Expand Down