-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: update the pandas.DataFrame.plot.box docstring #20373
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
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.
Apart from the typo in the extended description, LGTM!
pandas/plotting/_core.py
Outdated
|
||
This method draws a box and whisker for each series in the DataFrame | ||
in a single chart. The boxes share the vertical axis, which | ||
makes makes it easier to compare if they are similar in scale. |
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.
"makes makes" → "makes"
Codecov Report
@@ Coverage Diff @@
## master #20373 +/- ##
==========================================
- Coverage 91.8% 91.78% -0.03%
==========================================
Files 152 152
Lines 49223 49223
==========================================
- Hits 45191 45179 -12
- Misses 4032 4044 +12
Continue to review full report at Codecov.
|
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 the PR! Added some comments
pandas/plotting/_core.py
Outdated
.. plot:: | ||
:context: close-figs | ||
|
||
>>> data = np.random.randint(0, 10, size=(25, 4)) |
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.
I think it is better to use normal distribution here (np.random.randn(25, 4)
), it gives a bit more natural boxplots (eg with outliers) than a uniform distribution.
pandas/plotting/_core.py
Outdated
-------- | ||
:meth:`pandas.DataFrame.boxplot` : Another method to draw a box plot. | ||
:meth:`pandas.Series.plot.box` : Draw a box plot from a Series object. | ||
:func:`matplotlib.pyplot.boxplot`: Draw a box plot in matplotlib. |
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.
The :meth:`..
part is not needed here, that is done automatically by sphinx.
pandas/plotting/_core.py
Outdated
in a single chart. The boxes share the vertical axis, which | ||
makes it easier to compare if they are similar in scale. | ||
Box plots are useful because they clearly show the median, | ||
quartiles and flier points in the data. |
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.
There is also the PR on the boxplot
method: #20152. It has also extended the summary, you can check if there are some additions over there you could also use here (eg I think the wikipedia link is interesting)
(ideally we would re-use this extended summary for both, but that is something we can fix later)
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.
I've tried to fix the issues that you commented.
The summary from #20152 is more explanatory so I've copied most of it here. I removed the mention to the by
parameter which, unless I'm missing something, is not yet implemented for plot.box. Is someone working on that?
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.
IMO this is good enough. We can consider creating some shared doc parts for both DataFrame.plot.box
and DataFrame.boxplot
later.
@lkxz Thanks for the updates, and for the PR! |
A bit late to the party, but I did it.
scripts/validate_docstrings.py <your-function-or-method>
git diff upstream/master -u -- "*.py" | flake8 --diff
python doc/make.py --single <your-function-or-method>
Due to issue #15079 I wasn't sure how to document the
by
argument. I will follow up to add it later.Changed kwds description according to #20348.