10000 fix issue #8000 - interpolation extrapolates over trailing missing values by grahamjeffries · Pull Request #8013 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

fix issue #8000 - interpolation extrapolates over trailing missing values #8013

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
test that interpolate doesn't extrapolate
Added a test that confirms that linear interpolation of a Series does not extrapolate over missing data that trails the last known value.
  • Loading branch information
grahamjeffries committed Aug 13, 2014
commit b92fe67a15a8a97f716a4b240d893dbc64e4dd66
6 changes: 6 additions & 0 deletions pandas/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,12 @@ def test_interp_datetime64(self):
result = df.interpolate(method='nearest')
expected = Series([1., 1., 3.], index=date_range('1/1/2000', periods=3))
assert_series_equal(result, expected)

def test_interp_trailing_nan(self):
s = Series([np.nan, 1, np.nan, 3, np.nan])
result = s.interpolate()
expected = Series([np.nan, 1, 2, 3, np.nan])
assert_series_equal(result, expected)

def test_describe(self):
_ = self.series.describe()
Expand Down
0