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

DOC: document optional arguments on plot submethods #27381

Conversation

hancar
Copy link

@hancar hancar commented Jul 13, 2019

@jbrockmendel
Copy link
Member

Is there an issue for this?

@hancar
Copy link
Author

hancar commented Jul 14, 2019

Is there an issue for this

#11042

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch 2 times, most recently from 2a80564 to a0bdf0b Compare July 14, 2019 14:43
@WillAyd WillAyd changed the title #11042 formatting DOC: document optional arguments on plot submethods Jul 15, 2019
@WillAyd WillAyd added the Docs label Jul 15, 2019
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

Rather than copy / paste this can you use the Appender decorator that we use for other docstrings? You can see a use of this in pandas.core.generic amongst other places

@WillAyd
Copy link
Member

WillAyd commented Aug 26, 2019

@hancar can you fix up merge conflicts and address comment above?

@hancar
Copy link
Author

hancar commented Aug 27, 2019

@hancar can you fix up merge conflicts and address comment above?

Oh, thank you for reminding, today I will find some time.

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch from a0bdf0b to 78c9620 Compare September 1, 2019 16:05
@pep8speaks
Copy link

pep8speaks commented Sep 1, 2019

Hello @hancar! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1336:89: E501 line too long (89 > 88 characters)
Line 1558:89: E501 line too long (89 > 88 characters)

Comment last updated at 2019-11-19 08:22:52 UTC

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch from 78c9620 to 83051d5 Compare September 1, 2019 16:21
@TomAugspurger
Copy link
Contributor

Seems like some test and code checks are failing. Let us know if you need help looking into them.

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch 3 times, most recently from 34adc6c to f0c41a0 Compare September 6, 2019 00:29
@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch from f0c41a0 to 6d85054 Compare September 15, 2019 20:45
@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch 8 times, most recently from 9a2f226 to d1a843b Compare October 10, 2019 22:10
@hancar
Copy link
Author

hancar commented Oct 14, 2019

Seems like some test and code checks are failing. Let us know if you need help looking into them.

Yes please, now I would really appreciate some help. It seems like the tests fail on some linting or docstring validation, but I didn't manage to rerun the tests locally to find the problem. This is from Checks/12_Testing docstring validation script.txt in the logs:

2019-10-10T22:31:39.8687326Z scripts/tests/test_validate_docstrings.py ..............................................x..x..............................................docstring1: err desc
2019-10-10T22:31:39.8688602Z docstring1: err desc
2019-10-10T22:31:39.8689131Z docstring1: err desc
2019-10-10T22:31:39.8689537Z docstring2: err desc
2019-10-10T22:31:39.8689947Z docstring2: err desc
2019-10-10T22:31:39.8717964Z ..EXECUTED
2019-10-10T22:31:39.8732189Z {"docstring1": {"errors": [["ER01", "err desc"], ["ER02", "err desc"], ["ER03", "err desc"]]}, "docstring2": {"errors": [["ER04", "err desc"], ["ER05", "err desc"]]}}.Series.foo: err desc
2019-10-10T22:31:39.8732941Z DataFrame.bar: err desc
2019-10-10T22:31:39.8733428Z Series.foobar: err desc
2019-10-10T22:31:39.8733849Z Series.foo: err desc
2019-10-10T22:31:39.8746350Z .

Can you give me some hint, please?

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

doesn't look like CI logs are available any more so not sure on error; you can of course run scripts/validate_docstrings.py locally which will likely give you more info

@@ -588,7 +607,7 @@ class PlotAccessor(PandasObject):
labels with "(right)" in the legend
include_bool : bool, default is False
If True, boolean values can be plotted.
**kwargs
`**kwargs` : keywords
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't need the backticks here

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch from d1a843b to 50bba72 Compare October 22, 2019 05:57
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

I think this is a nice PR. Let's see if we can fix up a bit and get this in

@@ -588,7 +607,7 @@ class PlotAccessor(PandasObject):
labels with "(right)" in the legend
include_bool : bool, default is False
If True, boolean values can be plotted.
**kwargs
**kwargs : keywords
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 you can revert this; shouldn't be necessary for args / kwargs

@@ -1051,7 +1084,8 @@ def box(self, by=None, **kwargs):
----------
by : str or sequence
Column in the DataFrame to group by.
**kwargs
%s
**kwargs : optional
Copy link
Member

Choose a reason for hiding this comment

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

same comment on kwargs


def bar(self, x=None, y=None, **kwargs):
"""
@Appender(_line_docs % _shared_docs)
Copy link
Member

Choose a reason for hiding this comment

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

Rather than putting this all in Appender you can use Appender with Substitution decorators. Check pandas.core.frame for pre-existing examples

Copy link
Author

Choose a reason for hiding this comment

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

Just to be sure: do you mean to replace

@Appender(_line_docs % _shared_docs)

by

@Substitution(_shared_docs)
@Appender(_line_docs)

???

For me this is just more decorators making the code more complex, but not really nicer. Even in pandas.core.frame there are counter examples:

@Appender(_shared_docs["align"] % _shared_doc_kwargs)

So, do we really want that many decorators?

Copy link
Member

Choose a reason for hiding this comment

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

OK sure. Looks like some CI failures can you merge master and we can get this one in

def bar(self, x=None, y=None, **kwargs):
"""
@Appender(_line_docs % _shared_docs)
def line(self, x=None, y=None, figsize=None, subplots=False, sharex=None,
Copy link
Member

Choose a reason for hiding this comment

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

While doing this you might as well make all of the new keywords "keyword only", i.e. don't allow them to be called positionally. Easier to do now than to try and go back and do it later

@alimcmaster1
Copy link
Member

Thanks for the PR @hancar - mind merging master and addressing @WillAyd comments whenever you have time- thanks!

@hancar hancar force-pushed the document.opt.arguments.on.plot.submethods branch from 50bba72 to 002fc51 Compare November 19, 2019 08:22
@WillAyd
Copy link
Member

WillAyd commented Dec 17, 2019

@hancar looks like some CI issues can you take a look?

@datapythonista
Copy link
Member

Closing as stale, @hancar if you want to finish this, please let us know to reopen.

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.

DOC: document optional arguments on plot submethods
7 participants