From 38c226914e145bc6d96cdce7101722bb6513327c Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Wed, 1 May 2019 17:01:39 +0900 Subject: [PATCH 1/4] Fix doctests in GroupBy.mean() to check output --- pandas/core/groupby/groupby.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index bd8a8852964e3..fc094243806ea 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -1117,7 +1117,6 @@ def mean(self, *args, **kwargs): each group. >>> df.groupby('A').mean() - >>> B C A 1 3.0 1.333333 @@ -1126,7 +1125,6 @@ def mean(self, *args, **kwargs): Groupby two columns and return the mean of the remaining column. >>> df.groupby(['A', 'B']).mean() - >>> C A B 1 2.0 2 @@ -1138,7 +1136,6 @@ def mean(self, *args, **kwargs): the group. >>> df.groupby('A')['B'].mean() - >>> A 1 3.0 2 4.0 From 5613fd36b30f3f15c73b7ae0920fcde87ae70c8a Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Wed, 1 May 2019 21:34:15 +0900 Subject: [PATCH 2/4] check groupby.py as well in CI --- ci/code_checks.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 51edc218cc2bd..3f0e172cfd6f5 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -227,7 +227,9 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests generic.py' ; echo $MSG - pytest -q --doctest-modules pandas/core/generic.py \ + pytest -q --doctest-modules \ + pandas/core/generic.py \ + pandas/core/groupby/groupby.py \ -k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs -to_clipboard" RET=$(($RET + $?)) ; echo $MSG "DONE" From 01c1f5cb315aaa536d82cbbb3aa67da8c38f8507 Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Wed, 1 May 2019 22:21:26 +0900 Subject: [PATCH 3/4] Add a new block for groupby.py --- ci/code_checks.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 3f0e172cfd6f5..6e9a6b7f5c7d6 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -227,12 +227,14 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests generic.py' ; echo $MSG - pytest -q --doctest-modules \ - pandas/core/generic.py \ - pandas/core/groupby/groupby.py \ + pytest -q --doctest-modules pandas/core/generic.py \ -k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs -to_clipboard" RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests groupby.py' ; echo $MSG + pytest -q --doctest-modules pandas/core/groupby/groupby.py + RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests top-level reshaping functions' ; echo $MSG pytest -q --doctest-modules \ pandas/core/reshape/concat.py \ From 9b2dd4622ba1d87658b2705de27ef6eac9b08913 Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Wed, 1 May 2019 23:23:27 +0900 Subject: [PATCH 4/4] Fix tests and exclude some tests --- ci/code_checks.sh | 2 +- pandas/core/groupby/groupby.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 6e9a6b7f5c7d6..1f9ada185f9a3 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -232,7 +232,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests groupby.py' ; echo $MSG - pytest -q --doctest-modules pandas/core/groupby/groupby.py + pytest -q --doctest-modules pandas/core/groupby/groupby.py -k"-cumcount -describe -pipe" RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests top-level reshaping functions' ; echo $MSG diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index fc094243806ea..2eb9171668d35 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -2142,7 +2142,7 @@ def head(self, n=5): -------- >>> df = pd.DataFrame([[1, 2], [1, 4], [5, 6]], - columns=['A', 'B']) + ... columns=['A', 'B']) >>> df.groupby('A', as_index=False).head(1) A B 0 1 2 @@ -2169,7 +2169,7 @@ def tail(self, n=5): -------- >>> df = pd.DataFrame([['a', 1], ['a', 2], ['b', 1], ['b', 2]], - columns=['A', 'B']) + ... columns=['A', 'B']) >>> df.groupby('A').tail(1) A B 1 a 2