Skip to content

API: pandas.Series.replace has different method signature to pandas.DataFrame.replace #4555

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
roblevy opened this issue Aug 13, 2013 · 5 comments
Milestone

Comments

@roblevy
Copy link
Contributor

roblevy commented Aug 13, 2013

Using Pandas 0.12.0

It's hard to think of why a DataFrame would allow a regex=True replace method, and a Series wouldn't. This must just be an oversight, right?

>>> test = pd.DataFrame(['hello','goodbye','thankyou'],columns=['to_replace'])
>>> test
  to_replace
0      hello
1    goodbye
2   thankyou
>>> test.replace("he", "je")
  to_replace
0      hello
1    goodbye
2   thankyou
>>> test.replace("he", "je", regex=True)
  to_replace
0      jello
1    goodbye
2   thankyou
>>> test['to_replace'].replace("he", "je", regex=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: replace() got an unexpected keyword argument 'regex'
@cpcloud
Copy link
Member

cpcloud commented Aug 13, 2013

I think this will be fixed in 0.13 by the Series -> NDFrame refactor.

@jreback
Copy link
Contributor

jreback commented Aug 13, 2013

yep...#3482

@jreback
Copy link
Contributor

jreback commented Aug 13, 2013

@roblevy this is why the refactor is happening in the first place! (to provide this kind of consistency)

@roblevy
Copy link
Contributor Author

roblevy commented Aug 15, 2013

Wow. I've just been pulled briefly into the whirlwind of development at the heart of the pandas project. So much going on that I (as a mere mortal user of the library) had no idea of. Look forward to 0.13.0. Keep up the amazing work!

@jreback
Copy link
Contributor

jreback commented Aug 16, 2013

related to #4118 / closed by #3482

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

No branches or pull requests

3 participants