Skip to content

Commit 4df308f

Browse files
HyukjinKwonjreback
authored andcommitted
DOC: Test doctests in pandas/core/groupby/groupby.py (#26255)
1 parent d3b9d9f commit 4df308f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

ci/code_checks.sh

+4
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
235235
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs -to_clipboard"
236236
RET=$(($RET + $?)) ; echo $MSG "DONE"
237237

238+
MSG='Doctests groupby.py' ; echo $MSG
239+
pytest -q --doctest-modules pandas/core/groupby/groupby.py -k"-cumcount -describe -pipe"
240+
RET=$(($RET + $?)) ; echo $MSG "DONE"
241+
238242
MSG='Doctests top-level reshaping functions' ; echo $MSG
239243
pytest -q --doctest-modules \
240244
pandas/core/reshape/concat.py \

pandas/core/groupby/groupby.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,6 @@ def mean(self, *args, **kwargs):
11171117
each group.
11181118
11191119
>>> df.groupby('A').mean()
1120-
>>>
11211120
B C
11221121
A
11231122
1 3.0 1.333333
@@ -1126,7 +1125,6 @@ def mean(self, *args, **kwargs):
11261125
Groupby two columns and return the mean of the remaining column.
11271126
11281127
>>> df.groupby(['A', 'B']).mean()
1129-
>>>
11301128
C
11311129
A B
11321130
1 2.0 2
@@ -1138,7 +1136,6 @@ def mean(self, *args, **kwargs):
11381136
the group.
11391137
11401138
>>> df.groupby('A')['B'].mean()
1141-
>>>
11421139
A
11431140
1 3.0
11441141
2 4.0
@@ -2145,7 +2142,7 @@ def head(self, n=5):
21452142
--------
21462143
21472144
>>> df = pd.DataFrame([[1, 2], [1, 4], [5, 6]],
2148-
columns=['A', 'B'])
2145+
... columns=['A', 'B'])
21492146
>>> df.groupby('A', as_index=False).head(1)
21502147
A B
21512148
0 1 2
@@ -2172,7 +2169,7 @@ def tail(self, n=5):
21722169
--------
21732170
21742171
>>> df = pd.DataFrame([['a', 1], ['a', 2], ['b', 1], ['b', 2]],
2175-
columns=['A', 'B'])
2172+
... columns=['A', 'B'])
21762173
>>> df.groupby('A').tail(1)
21772174
A B
21782175
1 a 2

0 commit comments

Comments
 (0)