Skip to content

Commit

Permalink
DOC: Enforce Numpy Docstring Validation for pandas.Series.max (#58573)
Browse files Browse the repository at this point in the history
* DOC: add RT03 for pandas.Series.max

* DOC: remove RT03 for pandas.Series.max
  • Loading branch information
tuhinsharma121 committed May 4, 2024
1 parent 4e6b9ce commit 006ed98
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.Series.list.flatten SA01" \
-i "pandas.Series.list.len SA01" \
-i "pandas.Series.lt PR07,SA01" \
-i "pandas.Series.max RT03" \
-i "pandas.Series.mean RT03,SA01" \
-i "pandas.Series.median RT03,SA01" \
-i "pandas.Series.min RT03" \
Expand Down
60 changes: 59 additions & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6157,14 +6157,72 @@ def min(
)

@deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="max")
@doc(make_doc("max", ndim=1))
def max(
self,
axis: Axis | None = 0,
skipna: bool = True,
numeric_only: bool = False,
**kwargs,
):
"""
Return the maximum of the values over the requested axis.
If you want the *index* of the maximum, use ``idxmax``.
This is the equivalent of the ``numpy.ndarray`` method ``argmax``.
Parameters
----------
axis : {index (0)}
Axis for the function to be applied on.
For `Series` this parameter is unused and defaults to 0.
For DataFrames, specifying ``axis=None`` will apply the aggregation
across both axes.
.. versionadded:: 2.0.0
skipna : bool, default True
Exclude NA/null values when computing the result.
numeric_only : bool, default False
Include only float, int, boolean columns.
**kwargs
Additional keyword arguments to be passed to the function.
Returns
-------
scalar or Series (if level specified)
The maximum of the values in the Series.
See Also
--------
numpy.max : Equivalent numpy function for arrays.
Series.min : Return the minimum.
Series.max : Return the maximum.
Series.idxmin : Return the index of the minimum.
Series.idxmax : Return the index of the maximum.
DataFrame.min : Return the minimum over the requested axis.
DataFrame.max : Return the maximum over the requested axis.
DataFrame.idxmin : Return the index of the minimum over the requested axis.
DataFrame.idxmax : Return the index of the maximum over the requested axis.
Examples
--------
>>> idx = pd.MultiIndex.from_arrays(
... [["warm", "warm", "cold", "cold"], ["dog", "falcon", "fish", "spider"]],
... names=["blooded", "animal"],
... )
>>> s = pd.Series([4, 2, 0, 8], name="legs", index=idx)
>>> s
blooded animal
warm dog 4
falcon 2
cold fish 0
spider 8
Name: legs, dtype: int64
>>> s.max()
8
"""
return NDFrame.max(
self, axis=axis, skipna=skipna, numeric_only=numeric_only, **kwargs
)
Expand Down

0 comments on commit 006ed98

Please sign in to comment.