Skip to content

Commit cbfc4cf

Browse files
DOC: add more examples
1 parent eadc129 commit cbfc4cf

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
206206
-i "pandas.Series.list.flatten SA01" \
207207
-i "pandas.Series.list.len SA01" \
208208
-i "pandas.Series.lt PR07,SA01" \
209-
-i "pandas.Series.mean RT03,SA01" \
210209
-i "pandas.Series.min RT03" \
211210
-i "pandas.Series.mod PR07" \
212211
-i "pandas.Series.mode SA01" \

pandas/core/series.py

+43-1
Original file line numberDiff line numberDiff line change
@@ -6266,14 +6266,56 @@ def prod(
62666266
)
62676267

62686268
@deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="mean")
6269-
@doc(make_doc("mean", ndim=1))
62706269
def mean(
62716270
self,
62726271
axis: Axis | None = 0,
62736272
skipna: bool = True,
62746273
numeric_only: bool = False,
62756274
**kwargs,
62766275
) -> Any:
6276+
"""
6277+
Return the mean of the values over the requested axis.
6278+
6279+
Parameters
6280+
----------
6281+
axis : {index (0)}
6282+
Axis for the function to be applied on.
6283+
For `Series` this parameter is unused and defaults to 0.
6284+
6285+
For DataFrames, specifying ``axis=None`` will apply the aggregation
6286+
across both axes.
6287+
6288+
.. versionadded:: 2.0.0
6289+
6290+
skipna : bool, default True
6291+
Exclude NA/null values when computing the result.
6292+
numeric_only : bool, default False
6293+
Include only float, int, boolean columns.
6294+
6295+
**kwargs
6296+
Additional keyword arguments to be passed to the function.
6297+
6298+
Returns
6299+
-------
6300+
scalar or Series (if level specified)
6301+
Median of the values for the requested axis.
6302+
6303+
See Also
6304+
--------
6305+
numpy.median : Equivalent numpy function for computing median.
6306+
Series.sum : Sum of the values.
6307+
Series.median : Median of the values.
6308+
Series.std : Standard deviation of the values.
6309+
Series.var : Variance of the values.
6310+
Series.min : Minimum value.
6311+
Series.max : Maximum value.
6312+
6313+
Examples
6314+
--------
6315+
>>> s = pd.Series([1, 2, 3])
6316+
>>> s.mean()
6317+
2.0
6318+
"""
62776319
return NDFrame.mean(
62786320
self, axis=axis, skipna=skipna, numeric_only=numeric_only, **kwargs
62796321
)

0 commit comments

Comments
 (0)