Skip to content

fix issue #8000 #8010

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
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
3 changes: 2 additions & 1 deletion pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1543,7 +1543,8 @@ def _interp_limit(invalid, limit):
inds = inds[firstIndex:]

result[firstIndex:][invalid] = np.interp(inds[invalid], inds[valid],
yvalues[firstIndex:][valid])
yvalues[firstIndex:][valid],
np.nan, np.nan)

if limit:
result[violate_limit] = np.nan
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ def test_groupby():

for k, v in grouped:
assert v == expected[k]


def test_interpolate_linear():
a = Series([np.nan, 1, np.nan, 3, np.nan]))
b = a.interpolate()
assert(b[4] == np.nan)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

construct an expected series and use assert_series equal

move this test to test_generic (u will see a whole bunch of other interpolation tests)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resubmitted as PR #8013 with suggested edits



def test_is_list_like():
Expand Down