Skip to content

Conversation

@grahamjeffries
Copy link
Contributor

This pull request is in response to issue #8000.

Changes to core/common.py add np.nan as the default value for missing values to the left and right non-missing values during interpolation. This prevents DataFrame.interpolate() from extrapolating the last non-missing value over all trailing missing values (the default).

Changes to tests/test_common.py add test coverage to the above change. A passing test is where an interpolated series with a trailing missing value maintains that trailing missing value after interpolation.

This commit changes `np.interp()` arguments to include the default values of the left and right parameters as np.nan. In effect, when pandas interpolates a Series with trailing missing data, missing data values are preserved rather than being overwritten with the default value (last non-missing value).
Added a test that confirms that linear interpolation of a Series does not extrapolate over missing data that trails the last known value.
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

@jreback
Copy link
Contributor

jreback commented Aug 13, 2014

FYI, in general to simply rebase the PR rather than submit a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants