From 4faf666f8049b021a3f0f43158e967e15db1625b Mon Sep 17 00:00:00 2001 From: gboeker Date: Sun, 21 Apr 2024 16:48:44 -0400 Subject: [PATCH 1/6] fix SA01 for mean and median DataFrame --- ci/code_checks.sh | 4 ++-- pandas/core/generic.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index cabc25b5e0ba5..5fc815d3c164e 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -89,8 +89,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.kurt RT03,SA01" \ -i "pandas.DataFrame.kurtosis RT03,SA01" \ -i "pandas.DataFrame.max RT03" \ - -i "pandas.DataFrame.mean RT03,SA01" \ - -i "pandas.DataFrame.median RT03,SA01" \ + -i "pandas.DataFrame.mean RT03" \ + -i "pandas.DataFrame.median RT03" \ -i "pandas.DataFrame.min RT03" \ -i "pandas.DataFrame.plot PR02,SA01" \ -i "pandas.DataFrame.pop SA01" \ diff --git a/pandas/core/generic.py b/pandas/core/generic.py index dbe2006642484..2ebc3a1639aa2 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -12544,7 +12544,7 @@ def make_doc(name: str, ndim: int) -> str: elif name == "median": base_doc = _num_doc desc = "Return the median of the values over the requested axis." - see_also = "" + see_also = _stat_func_see_also examples = """ Examples @@ -12585,7 +12585,7 @@ def make_doc(name: str, ndim: int) -> str: elif name == "mean": base_doc = _num_doc desc = "Return the mean of the values over the requested axis." - see_also = "" + see_also = _stat_func_see_also examples = """ Examples From a59e3094dd7b080f934ac70176ed1b23dcff99f8 Mon Sep 17 00:00:00 2001 From: gboeker Date: Sun, 21 Apr 2024 17:01:43 -0400 Subject: [PATCH 2/6] add mean and median see also --- pandas/core/generic.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 2ebc3a1639aa2..6458454a5114f 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -12544,7 +12544,10 @@ def make_doc(name: str, ndim: int) -> str: elif name == "median": base_doc = _num_doc desc = "Return the median of the values over the requested axis." - see_also = _stat_func_see_also + see_also = """ + See Also + -------- + DataFrame.mean : Return the mean of the values over the requested axis.""" examples = """ Examples @@ -12585,7 +12588,11 @@ def make_doc(name: str, ndim: int) -> str: elif name == "mean": base_doc = _num_doc desc = "Return the mean of the values over the requested axis." - see_also = _stat_func_see_also + see_also = """ + See Also + -------- + DataFrame.median : Return the median of the values over the requested + axis.""" examples = """ Examples From ef7a23cdd2ce76fb57a66749a514673654b269fe Mon Sep 17 00:00:00 2001 From: gboeker Date: Sun, 21 Apr 2024 17:08:37 -0400 Subject: [PATCH 3/6] fix SA01 issues for DataFrame.plot --- ci/code_checks.sh | 2 +- pandas/plotting/_core.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 5fc815d3c164e..1238e8dea227d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -92,7 +92,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.mean RT03" \ -i "pandas.DataFrame.median RT03" \ -i "pandas.DataFrame.min RT03" \ - -i "pandas.DataFrame.plot PR02,SA01" \ + -i "pandas.DataFrame.plot PR02" \ -i "pandas.DataFrame.pop SA01" \ -i "pandas.DataFrame.prod RT03" \ -i "pandas.DataFrame.product RT03" \ diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 60bb45d3ac1dc..0ddfed580f903 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -790,6 +790,11 @@ class PlotAccessor(PandasObject): If the backend is not the default matplotlib one, the return value will be the object returned by the backend. + See Also + -------- + DataFrame.plot.area : Draw a stacked area plot. An area plot displays quantitative + data visually. This function wraps the matplotlib area function. + Notes ----- - See matplotlib documentation online for more on this subject From b684c3e67ef5d924dee0e2b79ccfc407b20d7b95 Mon Sep 17 00:00:00 2001 From: gboeker Date: Sun, 21 Apr 2024 17:13:44 -0400 Subject: [PATCH 4/6] fix SA01 erros for DataFrame.pop --- ci/code_checks.sh | 1 - pandas/core/frame.py | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 1238e8dea227d..0cd769d3842d0 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -93,7 +93,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.DataFrame.median RT03" \ -i "pandas.DataFrame.min RT03" \ -i "pandas.DataFrame.plot PR02" \ - -i "pandas.DataFrame.pop SA01" \ -i "pandas.DataFrame.prod RT03" \ -i "pandas.DataFrame.product RT03" \ -i "pandas.DataFrame.reorder_levels SA01" \ diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 0185ca8241617..83ed4a420f858 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5535,6 +5535,14 @@ def pop(self, item: Hashable) -> Series: Series Series representing the item that is dropped. + See Also + -------- + DataFrame.tail : Return the last n rows. This function returns last n rows + from the object based on position. It is useful for quickly verifying data, + for example, after sorting or appending rows. + + + Examples -------- >>> df = pd.DataFrame( From 602add45ba9cd87a41ed7276e0f09942a8432c1d Mon Sep 17 00:00:00 2001 From: gboeker Date: Sun, 21 Apr 2024 18:23:42 -0400 Subject: [PATCH 5/6] fix docstring errors --- ci/code_checks.sh | 10 +++++----- pandas/core/frame.py | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 0cd769d3842d0..b99622e7102bc 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -337,8 +337,8 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.list.len SA01" \ -i "pandas.Series.lt PR07,SA01" \ -i "pandas.Series.max RT03" \ - -i "pandas.Series.mean RT03,SA01" \ - -i "pandas.Series.median RT03,SA01" \ + -i "pandas.Series.mean RT03" \ + -i "pandas.Series.median RT03" \ -i "pandas.Series.min RT03" \ -i "pandas.Series.mod PR07" \ -i "pandas.Series.mode SA01" \ @@ -347,7 +347,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.Series.ne PR07,SA01" \ -i "pandas.Series.nunique RT03" \ -i "pandas.Series.pad PR01,SA01" \ - -i "pandas.Series.plot PR02,SA01" \ + -i "pandas.Series.plot PR02" \ -i "pandas.Series.pop RT03,SA01" \ -i "pandas.Series.pow PR07" \ -i "pandas.Series.prod RT03" \ @@ -619,7 +619,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.core.groupby.DataFrameGroupBy.nth PR02" \ -i "pandas.core.groupby.DataFrameGroupBy.nunique SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.ohlc SA01" \ - -i "pandas.core.groupby.DataFrameGroupBy.plot PR02,SA01" \ + -i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \ -i "pandas.core.groupby.DataFrameGroupBy.prod SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.sem SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.sum SA01" \ @@ -637,7 +637,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.core.groupby.SeriesGroupBy.min SA01" \ -i "pandas.core.groupby.SeriesGroupBy.nth PR02" \ -i "pandas.core.groupby.SeriesGroupBy.ohlc SA01" \ - -i "pandas.core.groupby.SeriesGroupBy.plot PR02,SA01" \ + -i "pandas.core.groupby.SeriesGroupBy.plot PR02" \ -i "pandas.core.groupby.SeriesGroupBy.prod SA01" \ -i "pandas.core.groupby.SeriesGroupBy.sem SA01" \ -i "pandas.core.groupby.SeriesGroupBy.sum SA01" \ diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 83ed4a420f858..b301f5affab1b 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -5541,8 +5541,6 @@ def pop(self, item: Hashable) -> Series: from the object based on position. It is useful for quickly verifying data, for example, after sorting or appending rows. - - Examples -------- >>> df = pd.DataFrame( From da543c230a0365f9f7d0e9a055800fb7fef26828 Mon Sep 17 00:00:00 2001 From: gboeker <68177766+gboeker@users.noreply.github.com> Date: Sat, 4 May 2024 20:53:05 -0400 Subject: [PATCH 6/6] add empty line before see also --- pandas/core/generic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 139bf72f5a35d..711be659145c5 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -12559,6 +12559,7 @@ def make_doc(name: str, ndim: int) -> str: base_doc = _num_doc desc = "Return the median of the values over the requested axis." see_also = """ + See Also -------- DataFrame.mean : Return the mean of the values over the requested axis.""" @@ -12603,6 +12604,7 @@ def make_doc(name: str, ndim: int) -> str: base_doc = _num_doc desc = "Return the mean of the values over the requested axis." see_also = """ + See Also -------- DataFrame.median : Return the median of the values over the requested