From 576e386a26a4f096e703271e636bea6dff67159e Mon Sep 17 00:00:00 2001 From: jmalp Date: Fri, 6 Dec 2024 11:30:22 -0800 Subject: [PATCH 1/4] fix docstrings validation for pandas.core.groupby.DataFrameGroupBy.boxplot --- ci/code_checks.sh | 1 - pandas/plotting/_core.py | 26 +++++++++++++++++++------- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index adc5bc9a01bdd..0977c3f6ca9a8 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -84,7 +84,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.arrays.IntervalArray.length SA01" \ -i "pandas.arrays.NumpyExtensionArray SA01" \ -i "pandas.arrays.TimedeltaArray PR07,SA01" \ - -i "pandas.core.groupby.DataFrameGroupBy.boxplot PR07,RT03,SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \ -i "pandas.core.groupby.SeriesGroupBy.plot PR02" \ -i "pandas.core.resample.Resampler.max PR01,RT03,SA01" \ diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index fbf9009cedc40..ae00a1ee4c23c 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -570,18 +570,23 @@ def boxplot_frame_groupby( Parameters ---------- - grouped : Grouped DataFrame + grouped : DataFrameGroupBy + The grouped DataFrame object over which to create the box plots. subplots : bool * ``False`` - no subplots will be used * ``True`` - create a subplot for each group. - column : column name or list of names, or vector Can be any valid input to groupby. fontsize : float or str - rot : label rotation angle - grid : Setting this to True will show the grid + Font size for the labels. + rot : float + Rotation angle of labels (in degrees) on the x-axis. + grid : bool + Whether to show grid lines on the plot. ax : Matplotlib axis object, default None - figsize : A tuple (width, height) in inches + The axes on which to draw the plots. If None, uses the current axes. + figsize : tuple of (float, float) + The figure size in inches (width, height). layout : tuple (optional) The layout of the plot: (rows, columns). sharex : bool, default False @@ -599,8 +604,15 @@ def boxplot_frame_groupby( Returns ------- - dict of key/value = group key/DataFrame.boxplot return value - or DataFrame.boxplot return value in case subplots=figures=False + dict or DataFrame.boxplot return value + If ``subplots=True``, returns a dictionary of group keys to the boxplot + return values. If ``subplots=False``, returns the boxplot return value + of a single DataFrame. + + See Also + -------- + pandas.DataFrame.boxplot : Create a box plot from a DataFrame. + pandas.Series.plot : Plot a Series. Examples -------- From 4f39637069451035083106c325d03574cd6f025a Mon Sep 17 00:00:00 2001 From: jmalp Date: Fri, 6 Dec 2024 11:42:09 -0800 Subject: [PATCH 2/4] fix trailing whitespace --- pandas/plotting/_core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index ae00a1ee4c23c..9a9cb964152c5 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -605,10 +605,10 @@ def boxplot_frame_groupby( Returns ------- dict or DataFrame.boxplot return value - If ``subplots=True``, returns a dictionary of group keys to the boxplot - return values. If ``subplots=False``, returns the boxplot return value + If ``subplots=True``, returns a dictionary of group keys to the boxplot + return values. If ``subplots=False``, returns the boxplot return value of a single DataFrame. - + See Also -------- pandas.DataFrame.boxplot : Create a box plot from a DataFrame. From 0f4aa570619e011666ac8fa0b44ab6bba7dc4979 Mon Sep 17 00:00:00 2001 From: jmalp Date: Fri, 6 Dec 2024 12:09:19 -0800 Subject: [PATCH 3/4] fix the error "pandas.Series.plot in `See Also` section does not need `pandas` prefix, use Series.plot instead." --- pandas/plotting/_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 9a9cb964152c5..0ace8fe37454a 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -612,7 +612,7 @@ def boxplot_frame_groupby( See Also -------- pandas.DataFrame.boxplot : Create a box plot from a DataFrame. - pandas.Series.plot : Plot a Series. + Series.plot : Plot a Series. Examples -------- From 76b51bbb1de87a3b4d0eedd3d87bf4e719e0dd72 Mon Sep 17 00:00:00 2001 From: jmalp Date: Fri, 6 Dec 2024 12:26:53 -0800 Subject: [PATCH 4/4] fix the error "pandas.DataFrame.boxplot in `See Also` section does not need `pandas` prefix, use DataFrame.boxplot instead." --- pandas/plotting/_core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 0ace8fe37454a..aee872f9ae50a 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -611,7 +611,7 @@ def boxplot_frame_groupby( See Also -------- - pandas.DataFrame.boxplot : Create a box plot from a DataFrame. + DataFrame.boxplot : Create a box plot from a DataFrame. Series.plot : Plot a Series. Examples