-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Clarify output of diff (returned type and possible overflow) #32699
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
Conversation
Thanks for the PR. I don't understand the comments though - can you maybe provide code for what you are trying to express? |
Thanks for working on this @mproszewska. Agree with @WillAyd, I don't understand what's the comment trying to explain. I can read what's the problem in the issue, but I don't think the added comment is helping users understand. Can you give it another try? |
Hello @mproszewska! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-05-31 13:11:56 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @mproszewska. Looking better, but just one idea about how to approach the problem.
And also, I think this PR is a good opportunity to unify the two docstrings that you're updating, so there is just one, and the other method reuses it. We have a @doc
decorator for it. The general idea would be something like:
class Series:
@doc(klass='Series', extra_params='', ...)
def diff(...):
"""
First discrete difference of element.
Calculates the difference of a {klass} element compared with another
...
"""
...
class DataFrame:
@doc(Series.diff, klass='DataFrame', extra_param="axis : {0 or 'index', 1 or 'columns'}, default 0...", ...)
def diff(...):
... # no docstring here, since it's reused the one from `Series.diff`
You have an example of using @doc
in #32787
Thanks for helping with this, let me know if you have any question.
Thanks @mproszewska. Can you use another variable Also, you've got conflicts. And if you can run Thanks! |
I can't run this script. I have numpydoc installed but I keep getting
I checked changed docs with |
You need to install the development version of numpydoc. It's in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for working on this @mproszewska
Only thing is that in the examples parameter I think we usually use textwrap.dedent
, to have the text indented, and make clear what it's the parameter, and where the function is defined. Can you have a look at other cases, and see if this is correct, please? Thanks!
Thanks @mproszewska Can you run And you'll have to run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mproszewska, very nice PR, lgtm
@mproszewska can you see if you can get the CI passing |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to wait for #33160 before we can merge this. But you can find where the FutureWarning
and change the stack level for now, and may be after that PR is merged we'll need to change that number again, but that should be easy once you found where it's being defined.
I changed stacklevel. Everything should be fine now. |
@mproszewska can you merge master and ping on green. @datapythonista over to you. |
Thanks @mproszewska, great PR. Can you have a look at https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.diff.html when it's updated, and see that everything looks as expected please? |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
diff
in Dataframa and Series