Skip to content

DOC: add Return Value Description to DataFrame.min #59586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.DataFrame.max RT03" \
-i "pandas.DataFrame.mean RT03" \
-i "pandas.DataFrame.median RT03" \
-i "pandas.DataFrame.min RT03" \
-i "pandas.DataFrame.plot PR02" \
-i "pandas.Grouper PR02" \
-i "pandas.MultiIndex.append PR07,SA01" \
Expand Down
59 changes: 58 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -11692,14 +11692,71 @@ def min(
) -> Series | Any: ...

@deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="min")
@doc(make_doc("min", ndim=2))
def min(
self,
axis: Axis | None = 0,
skipna: bool = True,
numeric_only: bool = False,
**kwargs,
) -> Series | Any:
"""
Return the minimum of the values over the requested axis.

If you want the *index* of the minimum, use ``idxmin``.
This is the equivalent of the ``numpy.ndarray`` method ``argmin``.

Parameters
----------
axis : {index (0), columns (1)}
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
-------
Series or scalar
The minimum of the values in the DataFrame.

See Also
--------
numpy.min : 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.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.min()
0
"""
result = super().min(
axis=axis, skipna=skipna, numeric_only=numeric_only, **kwargs
)
Expand Down
10 changes: 0 additions & 10 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -12532,16 +12532,6 @@ def make_doc(name: str, ndim: int) -> str:
see_also = _all_see_also
examples = _all_examples
kwargs = {"empty_value": "True"}
elif name == "min":
base_doc = _num_doc
desc = (
"Return the minimum of the values over the requested axis.\n\n"
"If you want the *index* of the minimum, use ``idxmin``. This is "
"the equivalent of the ``numpy.ndarray`` method ``argmin``."
)
see_also = _stat_func_see_also
examples = _min_examples
kwargs = {"min_count": ""}
elif name == "max":
base_doc = _num_doc
desc = (
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6524,7 +6524,7 @@ def min(
Returns
-------
scalar or Series (if level specified)
The maximum of the values in the Series.
The minimum of the values in the Series.

See Also
--------
Expand Down