Skip to content

Commit 42d40af

Browse files
authored
DOC: Docstring EX03 fixes for pandas.DataFrame methods (#56898)
1 parent 4921e0b commit 42d40af

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
9191
pandas.io.formats.style.Styler.highlight_quantile \
9292
pandas.io.formats.style.Styler.background_gradient \
9393
pandas.io.formats.style.Styler.text_gradient \
94-
pandas.DataFrame.values \
95-
pandas.DataFrame.groupby \
96-
pandas.DataFrame.sort_values \
9794
pandas.DataFrame.plot.hexbin \
9895
pandas.DataFrame.plot.line \
9996
RET=$(($RET + $?)) ; echo $MSG "DONE"

pandas/core/frame.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -7087,8 +7087,8 @@ def sort_values(
70877087
using the `natsort <https://github.com/SethMMorton/natsort>` package.
70887088
70897089
>>> df = pd.DataFrame({
7090-
... "time": ['0hr', '128hr', '72hr', '48hr', '96hr'],
7091-
... "value": [10, 20, 30, 40, 50]
7090+
... "time": ['0hr', '128hr', '72hr', '48hr', '96hr'],
7091+
... "value": [10, 20, 30, 40, 50]
70927092
... })
70937093
>>> df
70947094
time value
@@ -9035,8 +9035,8 @@ def update(
90359035
We can also choose to include NA in group keys or not by setting
90369036
`dropna` parameter, the default setting is `True`.
90379037
9038-
>>> l = [[1, 2, 3], [1, None, 4], [2, 1, 3], [1, 2, 2]]
9039-
>>> df = pd.DataFrame(l, columns=["a", "b", "c"])
9038+
>>> arr = [[1, 2, 3], [1, None, 4], [2, 1, 3], [1, 2, 2]]
9039+
>>> df = pd.DataFrame(arr, columns=["a", "b", "c"])
90409040
90419041
>>> df.groupby(by=["b"]).sum()
90429042
a c
@@ -9051,8 +9051,8 @@ def update(
90519051
2.0 2 5
90529052
NaN 1 4
90539053
9054-
>>> l = [["a", 12, 12], [None, 12.3, 33.], ["b", 12.3, 123], ["a", 1, 1]]
9055-
>>> df = pd.DataFrame(l, columns=["a", "b", "c"])
9054+
>>> arr = [["a", 12, 12], [None, 12.3, 33.], ["b", 12.3, 123], ["a", 1, 1]]
9055+
>>> df = pd.DataFrame(arr, columns=["a", "b", "c"])
90569056
90579057
>>> df.groupby(by="a").sum()
90589058
b c
@@ -12569,7 +12569,7 @@ def values(self) -> np.ndarray:
1256912569
A DataFrame where all columns are the same type (e.g., int64) results
1257012570
in an array of the same type.
1257112571
12572-
>>> df = pd.DataFrame({'age': [ 3, 29],
12572+
>>> df = pd.DataFrame({'age': [3, 29],
1257312573
... 'height': [94, 170],
1257412574
... 'weight': [31, 115]})
1257512575
>>> df
@@ -12589,10 +12589,10 @@ def values(self) -> np.ndarray:
1258912589
results in an ndarray of the broadest type that accommodates these
1259012590
mixed types (e.g., object).
1259112591
12592-
>>> df2 = pd.DataFrame([('parrot', 24.0, 'second'),
12593-
... ('lion', 80.5, 1),
12592+
>>> df2 = pd.DataFrame([('parrot', 24.0, 'second'),
12593+
... ('lion', 80.5, 1),
1259412594
... ('monkey', np.nan, None)],
12595-
... columns=('name', 'max_speed', 'rank'))
12595+
... columns=('name', 'max_speed', 'rank'))
1259612596
>>> df2.dtypes
1259712597
name object
1259812598
max_speed float64

0 commit comments

Comments
 (0)