Skip to content

Commit 89bfac8

Browse files
author
Thomas Lautenschlaeger
committed
added notes for documentation
1 parent 4b5f240 commit 89bfac8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pandas/core/frame.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9142,6 +9142,24 @@ def _gotitem(
91429142
2 8.0
91439143
3 NaN
91449144
dtype: float64
9145+
9146+
Aggregate functions on DataFrames with mixed non-numeric and numeric columns.
9147+
9148+
>>> df = pd.DataFrame([['a', 1, 4],
9149+
... ['b', 2, 5],
9150+
... ['c', 3, 6]],
9151+
... columns=['A', 'B', 'C'])
9152+
9153+
Works equivalently as above. Add argument `numeric_only=True` to avoid
9154+
exceptions or warnings.
9155+
9156+
>>> df.agg({'A': 'mean', 'B': [pd.DataFrame.mean, 'std'], 'C': ['sum', 'mean']},
9157+
... numeric_only=True)
9158+
9159+
B C
9160+
mean 2.0 5.0
9161+
std 1.0 NaN
9162+
sum NaN 15.0
91459163
"""
91469164
)
91479165

0 commit comments

Comments
 (0)