Skip to content

BUG: replace with a scalar works like a list of to_replace for compat with 0.12 (GH5319) #5600

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

Merged
merged 1 commit into from
Dec 1, 2013

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Nov 27, 2013

closes #5319

Essentitally this is ffill

In [1]: Series([1,np.nan,2]).replace([np.nan])
Out[1]: 
0    1
1    1
2    2
dtype: float64

In [2]: Series([1,np.nan,2]).replace(np.nan)
Out[2]: 
0    1
1    1
2    2
dtype: float64

A bit confusing on a Frame, so raise an error

In [3]: DataFrame(randn(5,2)).replace(np.nan)
TypeError: cannot replace [nan] with method pad on a DataFrame

This was the exception before this PR on a Frame

TypeError: If "to_replace" and "value" are both None and "to_replace" is not a list, then regex must be a mapping

@jreback
Copy link
Contributor Author

jreback commented Nov 29, 2013

@cpcloud can you take a look?

jreback added a commit that referenced this pull request Dec 1, 2013
BUG: replace with a scalar works like a list of to_replace for compat with 0.12 (GH5319)
@jreback jreback merged commit c239b06 into pandas-dev:master Dec 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression for pd.Series.replace(np.nan, inplace=True)
1 participant