Skip to content
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

Various docstring fixes #28744

Merged

Conversation

ChiefMilesEdgeworth
Copy link
Contributor

@ChiefMilesEdgeworth ChiefMilesEdgeworth commented Oct 2, 2019

  • xref Fix PR02 issues in docstrings #27976

  • tests added / passed - Didn't run all tests, only those concerning the issue (./scripts/validate_docstrings.py pandas.Series.drop --errors=PR02)

  • passes black pandas - Only docstrings were edited, so there were no major changes

  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

  • whatsnew entry - Not needed, only docs changed
    General fixes to the documentation in different places. I discovered that the root of many of the conflicts lies in decorators. We might need to re-evaluate how we're getting the signature of functions in the validation script.

First time submitting a PR! Let me know if I need to do anything, or if there's anything I should do differently next time :)

Simple error fixes for idxmin and idxmax regarding their docstrings
Fixed errors on swaplevel, rename, and drop methods
Fixed methods mean, std, var, and corr in ewm.py. 
Fixed methods sum, apply, max, std, var, and quantile in rolling.py
Fixed functions table, scatter_matrix, radviz, bootstrap_plot, parallel_coordinates, lag_plot, and autocorrelation_plot. Noticed that functions with the @deprecate_kwarg decorator tend to not behave correctly with the tests.
Fixed the docstring for transpose, eval, swaplevel, and melt in frame.py
Just missed the one line.
Caught small whitespace issues.
Fixed errors shown by automated tests (PR04 and GL03)
@angelaambroz
Copy link
Contributor

Oh, uh - I guess this PR re-does what mine did - plus additional stuff. No sense merging both, so looks like this one might be a superset of mine. So much for my first PR on pandas... 😞

@ChiefMilesEdgeworth
Copy link
Contributor Author

ChiefMilesEdgeworth commented Oct 2, 2019 via email

Fixed issues shown by automated tests with error PR03.
@angelaambroz
Copy link
Contributor

Thanks for the follow-up. Yeah, it's hard to find unclaimed work on these projects. (I've been looking here and on scikit-learn.) I'll take a look at the remaining stuff. 👍

@ChiefMilesEdgeworth
Copy link
Contributor Author

I'm not sure why the Travis CI build failed. Could I get a pointer on how to fix it, or was the code not at fault?

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for working on all those. Added some comments, all the args and kwargs should be merged, unless they really require different descriptions.

*args
Additional arguments have no effect but might be accepted for
compatibility with numpy.
**kwargs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is wrong in this case, please revert

@@ -3237,7 +3237,7 @@ def eval(self, expr, inplace=False, **kwargs):
If the expression contains an assignment, whether to perform the
operation inplace and mutate the existing DataFrame. Otherwise,
a new DataFrame is returned.
kwargs : dict
**kwargs : dict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove the type

*args
Additional arguments have no effect but might be accepted
for compatability with NumPy
**kwargs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge those please

@@ -5205,8 +5205,10 @@ def swaplevel(self, i=-2, j=-1, axis=0):

Parameters
----------
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
i : int, str (can be mixed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int or str, not sure what the can be mixed means here, but shouldn't be in the type (can be explained in the description)

*args
Additional arguments have no effect but might be accepted
for compatibility with NumPy.
**kwargs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please merge args and kwargs

**kwargs
Keyword arguments to be passed into func.
Keyword arguments to be passed into func.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge args and kwargs

output will be a MultiIndex DataFrame in the case of DataFrame
inputs. In the case of missing elements, only complete pairwise
observations will be used.
**kwargs : dict of {str : Any}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the type

"""

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this blank line, this is probably breaking the CI

*args, **kwargs
args : tuple of Any
Arguments and keyword arguments to be passed into func.
kwargs : dict of {str : any}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the types, aren't those *args instead of args?

@@ -398,7 +398,7 @@ def lag_plot(series, lag=1, ax=None, **kwds):
series : Time series
lag : lag of the scatter plot, default 1
ax : Matplotlib axis object, optional
kwds : Matplotlib scatter method keyword arguments, optional
**kwds : Matplotlib scatter method keyword arguments, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this to the description, no type for star params

Put args and kwargs back on the same line, since that's how the documentation should be. The validation script needs to be changed to catch this.
@pep8speaks
Copy link

pep8speaks commented Oct 3, 2019

Hello @Nabel0721! 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 2019-11-08 03:21:11 UTC

Should've checked it before commiting. Two very small fixes
@ChiefMilesEdgeworth
Copy link
Contributor Author

I'm going to start looking into fixing the validation script so it catches more of these properly, since the correct format for the docs is to have args and kwargs in the same line.

@datapythonista
Copy link
Member

Can't look now, but I think there is an issue for it.

@ChiefMilesEdgeworth
Copy link
Contributor Author

I think this (#20298) is it. If you'd like I can comment on there with this issue. There's another part I'd like to fix as well, which I commented about in #27976.

@datapythonista
Copy link
Member

Sure, will be great to see both fixed.

@ChiefMilesEdgeworth
Copy link
Contributor Author

This is ready to be merged, I have the changes to the validation script in a separate pull request, since it addresses a different problem.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, other than that looks good

*args
Arguments to be passed into func.
**kwargs
Keyword arguments to be passed into func.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better revert this please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not resolve this and mark as resolved? I think your proposed change is incorrect, the original is more accurate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea why I missed these. I'll get them right away.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it looks like I just forgot to mark this as resolved. It should be fixed in the last commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not reverted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert please

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason it's showing up as reverted on my machine, but not here. I'll just do the edits on Github.

pandas/core/series.py Outdated Show resolved Hide resolved
pandas/plotting/_misc.py Outdated Show resolved Hide resolved
Merged *args and **kwargs, removed a duplicate documentation, and removed the type for **kwargs.
@ChiefMilesEdgeworth
Copy link
Contributor Author

Issues are fixed. Thanks for working through this with me!

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couple of small things, but looks good besides that

*args
Arguments to be passed into func.
**kwargs
Keyword arguments to be passed into func.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not resolve this and mark as resolved? I think your proposed change is incorrect, the original is more accurate.

Level of index to be swapped. Can pass level name as string.
i : int, str
Level of first index to be swapped. Can pass level name as string.
j : int, str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int or str in both cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you can also merge them back

i : int or str
Level of first index to be swapped. Can pass level name as string.
j : int or str
Level of second index to be swapped. Can pass level name as string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd merge those, I think the validation script should accept this, as proposed in the PR where you update it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the proposed script does not validate any variables on the same line, just *args and **kwargs. I left it that way in case we decide we don't want people to just throw a bunch of variables on the same line. If you think that'd be fine, then I can rewrite the script update to allow for that, and change these here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR allowing having those together was merged, right? Can you have i, j instead please

i : int or str
Level of first index to be swapped. Can pass level name as string.
j : int or str
Level of second index to be swapped. Can pass level name as string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the PR allowing having those together was merged, right? Can you have i, j instead please

Level of index to be swapped. Can pass level name as string.
i : int, str
Level of first index to be swapped. Can pass level name as string.
j : int, str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

*args
Arguments to be passed into func.
**kwargs
Keyword arguments to be passed into func.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's not reverted.

@@ -398,7 +398,8 @@ def lag_plot(series, lag=1, ax=None, **kwds):
series : Time series
lag : lag of the scatter plot, default 1
ax : Matplotlib axis object, optional
kwds : Matplotlib scatter method keyword arguments, optional
**kwds
Matplotlib scatter method keyword arguments, optional
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the optional, and end with period.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fixes, few comments

pandas/core/frame.py Show resolved Hide resolved
i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
i, j: int or str
Levels indecies to be swapped. Can pass level name as string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo, indices

i, j : int, str (can be mixed)
Level of index to be swapped. Can pass level name as string.
i, j : int, str
Level of the indecies to be swapped. Can pass level name as string.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same typo

*args
Arguments to be passed into func.
**kwargs
Keyword arguments to be passed into func.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert please

Added a space between a parameter and the colon.
Fixed typos on documentation
Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, couple of comments.

pandas/core/frame.py Outdated Show resolved Hide resolved
pandas/core/window/ewm.py Outdated Show resolved Hide resolved
@datapythonista
Copy link
Member

@Nabel0721 do you have time to commit the last changes?

And next time it'd be better if you leave checked the checkbox to let maintainers commit to your branch, and we could do it ourselves.

Thanks!

@ChiefMilesEdgeworth
Copy link
Contributor Author

I got really busy unexpectedly, so I don't think I'll have time for a couple more weeks. I do think I have the "allow edits from maintainers" checkbox on, so I'm not sure why it's showing up as off on your end. If you are able to make edits though, feel free.

@WillAyd
Copy link
Member

WillAyd commented Nov 8, 2019

Nice PR but sounds like it is stale (or at least will be for the foreseeable future).

@Nabel0721 ping if you'd like to pick this back up and can reopen

@WillAyd WillAyd closed this Nov 8, 2019
@ChiefMilesEdgeworth
Copy link
Contributor Author

ChiefMilesEdgeworth commented Nov 8, 2019 via email

@datapythonista datapythonista reopened this Nov 8, 2019
@datapythonista
Copy link
Member

@Nabel0721 the only thing pending is literally clicking on the Commit suggestions buttons in this comment: #28744 (review)

We can't do it ourselves (github issue, or you didn't allow maintainers to edit this PR). If you can spend one minute doing that, we can merge this changes.

I didn't know I could do this

Co-Authored-By: Marc Garcia <garcia.marc@gmail.com>
Small change to wording

Co-Authored-By: Marc Garcia <garcia.marc@gmail.com>
@ChiefMilesEdgeworth
Copy link
Contributor Author

Sorry, I didn't know I could do that. I would have done it a while ago if I had known.

@ChiefMilesEdgeworth
Copy link
Contributor Author

It must be a github issue that you can't do edits though. I checked again and the allow edits checkbox is still checked. Sorry for how long this has taken to finish up, but thank you for being patient.

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks a lot @Nabel0721 for fixing all this. Hope to see you back when you have more free time!

@ChiefMilesEdgeworth
Copy link
Contributor Author

For sure. It's always nice to get to work on python code.

@WillAyd WillAyd added this to the 1.0 milestone Nov 8, 2019
@WillAyd WillAyd merged commit 69c61c5 into pandas-dev:master Nov 8, 2019
@WillAyd
Copy link
Member

WillAyd commented Nov 8, 2019

Great thanks @Nabel0721 and @datapythonista

Reksbril pushed a commit to Reksbril/pandas that referenced this pull request Nov 18, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants