Skip to content

interpolate erroneously fills NaNs at start of series when limit_direction == 'both' #11115

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
lmjohns3 opened this issue Sep 15, 2015 · 1 comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Milestone

Comments

@lmjohns3
Copy link

PR #10691 had a bug in computing the NaN mask in certain cases.

Specifically, when a NaN occurs within limit of the beginning of the series and limit_direction is set to 'both', the interpolation code will erroneously interpolate these NaNs rather than masking them off.

From the PR:

In [43]: ser = pd.Series([np.nan, np.nan, 5, np.nan, np.nan, np.nan, 13])
In [44]: ser.interpolate(limit=1, limit_direction='both')
Out[44]: 
0     5
1     5
2     5
3     7
4   NaN
5    11
6    13
dtype: float64

This should actually give:

Out[44]: 
0     NaN
1     5
2     5
3     7
4   NaN
5    11
6    13
dtype: float64
@jorisvandenbossche jorisvandenbossche added this to the 0.17.0 milestone Sep 15, 2015
@jorisvandenbossche jorisvandenbossche added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Sep 15, 2015
@jreback
Copy link
Contributor

jreback commented Sep 16, 2015

closed by #11124

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
Development

No branches or pull requests

3 participants