Skip to content

Commit f2b0129

Browse files
tuhinsharma121pmhatre1
authored andcommitted
DOC: Enforce Numpy Docstring Validation for pandas.Series.mean (pandas-dev#58574)
* DOC: add more examples * DOC: add more examples
1 parent 002fa40 commit f2b0129

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

ci/code_checks.sh

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
200200
-i "pandas.Series.list.flatten SA01" \
201201
-i "pandas.Series.list.len SA01" \
202202
-i "pandas.Series.lt PR07,SA01" \
203-
-i "pandas.Series.mean RT03,SA01" \
204203
-i "pandas.Series.min RT03" \
205204
-i "pandas.Series.mod PR07" \
206205
-i "pandas.Series.mode SA01" \

pandas/core/series.py

+42-1
Original file line numberDiff line numberDiff line change
@@ -6266,14 +6266,55 @@ 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+
**kwargs
6295+
Additional keyword arguments to be passed to the function.
6296+
6297+
Returns
6298+
-------
6299+
scalar or Series (if level specified)
6300+
Median of the values for the requested axis.
6301+
6302+
See Also
6303+
--------
6304+
numpy.median : Equivalent numpy function for computing median.
6305+
Series.sum : Sum of the values.
6306+
Series.median : Median of the values.
6307+
Series.std : Standard deviation of the values.
6308+
Series.var : Variance of the values.
6309+
Series.min : Minimum value.
6310+
Series.max : Maximum value.
6311+
6312+
Examples
6313+
--------
6314+
>>> s = pd.Series([1, 2, 3])
6315+
>>> s.mean()
6316+
2.0
6317+
"""
62776318
return NDFrame.mean(
62786319
self, axis=axis, skipna=skipna, numeric_only=numeric_only, **kwargs
62796320
)

0 commit comments

Comments
 (0)