Skip to content

Commit 253e3eb

Browse files
committed
fix fix doc string
1 parent b32c5a8 commit 253e3eb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pandas/core/arrays/base.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,14 +1442,24 @@ def _reduce(self, name: str, *, skipna: bool = True, **kwargs):
14421442
return meth(skipna=skipna, **kwargs)
14431443

14441444
def _reduce_with_wrap(self, name: str, *, skipna: bool = True, kwargs):
1445-
"""Call ``_reduce`` and wrap the result in a ndarray/extensionArray.
1445+
"""
1446+
Call ``_reduce`` and wrap the result in a ndarray/ExtensionArray.
14461447
14471448
This is used to control the returned dtype when doing reductions in DataFrames,
14481449
and ensures the correct dtype for e.g. ``DataFrame({"a": extr_arr2}).sum()``.
14491450
14501451
Returns
14511452
-------
1452-
ndarray orx ExtensionArray
1453+
ndarray or ExtensionArray
1454+
1455+
Examples
1456+
--------
1457+
>>> import pandas as pd
1458+
>>> arr = pd.array([1, 2, pd.NA])
1459+
>>> arr._reduce_with_wrap("sum", kwargs={})
1460+
<IntegerArray>
1461+
[3]
1462+
Length: 1, dtype: Int64
14531463
"""
14541464
result = self._reduce(name, skipna=skipna, **kwargs)
14551465
return np.array([[result]])

0 commit comments

Comments
 (0)