diff --git a/doc/source/release.rst b/doc/source/release.rst index ae95c882fe356..1568a2c3af439 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -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 ------------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 0a0cfe94409f9..68b35db3827c8 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -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 diff --git a/pandas/tests/test_generic.py b/pandas/tests/test_generic.py index eb7f178df39d8..958ca81b0a2ee 100644 --- a/pandas/tests/test_generic.py +++ b/pandas/tests/test_generic.py @@ -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])