-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Series.replace and DataFrame.replace have same docstring? #13852
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
Comments
One other minor nit. Should the following edge case be supported? It currently raises a ValueError if you pass an empty dict.
I'm not 100% sure this should even be allowed because of the docstring confusion, though. |
Thanks for the report. Yeah doc improvement is appreciated. It should be re-defined in -https://github.com/pydata/pandas/blob/master/pandas/core/generic.py#L2219 I think the empty case should be supported to do nothing like other methods.
|
Hey, I am interested! How should I go about solving this? |
@RaghavBatra : I think the comment by @sinhrks above nicely describes what needs to be done. If you can write a new docstring for |
@gfyoung, I looked at the counter example @kyleabeauchamp gave above and I don't see any problem with it: 0 1 |
@RaghavBatra : Can you confirm that passing in both |
@gfyoung, yes it works for the DataFrame counterexample above. I also tried the Series.replace function. That worked as well!
|
@RaghavBatra : Thanks for looking into this! |
@gfyoung glad to be of help! |
@RaghavBatra : https://github.com/pandas-dev/pandas/issues lists all open issues that you are more than welcome to tackle! |
For me, this issue was about the doctring in general, and not only that specific issue. The docstring of |
OK, so I downloaded and built the documentation. I even found the HTML version of the Series.replace function. |
Do a GitHub search in this repository for a portion of the docstring, and you should be able to figure out where it is. |
That only seems to bring up the HTML generated doc! Any other tips? |
The docstring can be found in |
Nope, still don't see it. :( |
It's right here (just click the hyperlink) |
Updated documentation so that it matched the functionality of pd.Series.replace and NOT pd.DataFrame.replace Fixes pandas-dev#13852
Done! |
The docstring for Series.replace refers to looking up column names, which AFAIK doesn't make sense for the Series version of
replace
. It seems like the Series function is just blindly inheriting the DataFrame docstring?http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.replace.html?highlight=replace#pandas.Series.replace
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.replace.html?highlight=replace#pandas.DataFrame.replace
For example, the following trivial example of
Series.replace()
does not agree with the docstring:The text was updated successfully, but these errors were encountered: