Skip to content

Added missing import in boxplot_frame_groupby example #34343

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

Merged

Conversation

gsyqax
Copy link
Contributor

@gsyqax gsyqax commented May 23, 2020

@MarcoGorelli
Copy link
Member

Thanks @gsyqax - did you build this page of the documentation locally to check it works?

@gsyqax gsyqax force-pushed the plotting_boxplot_example_import branch from 5c3b913 to f81fb81 Compare May 23, 2020 16:21
@gsyqax
Copy link
Contributor Author

gsyqax commented May 23, 2020

@MarcoGorelli yes, it is working.

I noticed the example also makes use of 'pd' and 'np' alias without importing and aliasing pandas and numpy. I don't think this can lead to confusion. Do you think I should also add those imports?

@MarcoGorelli
Copy link
Member

That's OK, it fits with the docstring guide

Import required libraries (except numpy and pandas)

@MarcoGorelli
Copy link
Member

MarcoGorelli commented May 23, 2020

@MarcoGorelli yes, it is working.

I just tried building it with your changes and I don't see any plot though, do you?

See the guide I linked to above for how to display plots in documentation examples

@gsyqax
Copy link
Contributor Author

gsyqax commented May 23, 2020

I'm not seeing any plots either. I thought a plot was not needed since the current version is not showing any either.

I will add the plots and commit again

@pep8speaks
Copy link

pep8speaks commented May 23, 2020

Hello @gsyqax! 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-07-06 14:53:37 UTC

@gsyqax gsyqax force-pushed the plotting_boxplot_example_import branch from 855448d to 28da625 Compare May 23, 2020 20:08
@gsyqax
Copy link
Contributor Author

gsyqax commented May 23, 2020

@MarcoGorelli I added some plots and made a few minor changes to make everything clearer, hope it's OK. Also removed whitespace as indicated by pep8speaks.

@gsyqax gsyqax force-pushed the plotting_boxplot_example_import branch from 28da625 to cda5819 Compare May 24, 2020 09:14
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Nice! Thanks, just tried running it and it looks good. Can you just add a space between the two examples, as suggested below?

@MarcoGorelli
Copy link
Member

Also, I don't think a whatsnew note is necessary for documentation improvements, could you please revert that change?

Co-authored-by: Marco Gorelli <33491632+MarcoGorelli@users.noreply.github.com>
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

LGTM

have opened #34353 as I'm not sure what to do about the subplots being too close (but it would warrant a separate PR anyway, I don't think there'd be any need to change that here)

@gsyqax
Copy link
Contributor Author

gsyqax commented May 24, 2020

Great! Many thanks @MarcoGorelli for all the help, really appreciate it!

@jreback jreback added this to the 1.1 milestone May 25, 2020
@jreback
Copy link
Contributor

jreback commented May 25, 2020

@charlesdong1991
Copy link
Member

try boxplot_frame_groupby(grouped, rot=45, fontsize=12, figsize=(8, 10)) for instance? @gsyqax

it will avoid having overlapped subplots and make doc look better

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

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

IMO we should not advertise boxplot_frame_groupby like that directly, but rather as df.groupby(..).boxplot(..)

@WillAyd
Copy link
Member

WillAyd commented May 27, 2020

Slight preference for what @jorisvandenbossche has suggested above but not a blocker so OK either way

@gsyqax
Copy link
Contributor Author

gsyqax commented May 30, 2020

I applied the change to the plot fig size and replaced boxplot_frame_groupby by df.groupby.boxplot. I'm keeping the intermediate var 'grouped' to make things easier to read

:context: close-figs

>>> import itertools
>>> from pandas.plotting import boxplot_frame_groupby
Copy link
Contributor

Choose a reason for hiding this comment

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

@gsyqax can you remove this import.

@jreback
Copy link
Contributor

jreback commented Jul 6, 2020

lgtm. @TomAugspurger

@TomAugspurger TomAugspurger merged commit 148f9fd into pandas-dev:master Jul 7, 2020
@TomAugspurger
Copy link
Contributor

Thanks @gsyqax!

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.

groupby boxplot example does not work
8 participants