MCPcopy
hub / github.com/pandas-dev/pandas / max

Method max

pandas/core/indexes/base.py:7746–7808  ·  view source on GitHub ↗

Return the maximum value of the Index. Parameters ---------- axis : int, optional For compatibility with NumPy. Only 0 or None are allowed. skipna : bool, default True Exclude NA/null values when showing the result. *args, **k

(self, axis: AxisInt | None = None, skipna: bool = True, *args, **kwargs)

Source from the content-addressed store, hash-verified

7744 return maybe_unbox_numpy_scalar(nanops.nanmin(self._values, skipna=skipna))
7745
7746 def max(self, axis: AxisInt | None = None, skipna: bool = True, *args, **kwargs):
7747 """
7748 Return the maximum value of the Index.
7749
7750 Parameters
7751 ----------
7752 axis : int, optional
7753 For compatibility with NumPy. Only 0 or None are allowed.
7754 skipna : bool, default True
7755 Exclude NA/null values when showing the result.
7756 *args, **kwargs
7757 Additional arguments and keywords for compatibility with NumPy.
7758
7759 Returns
7760 -------
7761 scalar
7762 Maximum value.
7763
7764 See Also
7765 --------
7766 Index.min : Return the minimum value in an Index.
7767 Series.max : Return the maximum value in a Series.
7768 DataFrame.max : Return the maximum values in a DataFrame.
7769
7770 Examples
7771 --------
7772 >>> idx = pd.Index([3, 2, 1])
7773 >>> idx.max()
7774 3
7775
7776 >>> idx = pd.Index(["c", "b", "a"])
7777 >>> idx.max()
7778 'c'
7779
7780 For a MultiIndex, the maximum is determined lexicographically.
7781
7782 >>> idx = pd.MultiIndex.from_product([("a", "b"), (2, 1)])
7783 >>> idx.max()
7784 ('b', 2)
7785 """
7786
7787 nv.validate_max(args, kwargs)
7788 nv.validate_minmax_axis(axis)
7789
7790 if not len(self):
7791 return self._na_value
7792
7793 if len(self) and self.is_monotonic_increasing:
7794 # quick check
7795 last = self[-1]
7796 if not isna(last):
7797 return maybe_unbox_numpy_scalar(last)
7798
7799 if not self._is_multi and self.hasnans:
7800 # Take advantage of cache
7801 mask = self._isnan
7802 if not skipna or mask.all():
7803 return maybe_unbox_numpy_scalar(self._na_value)

Callers 11

_wrap_resultMethod · 0.45
deleteMethod · 0.45
validate_indicesFunction · 0.45
_nbins_to_binsFunction · 0.45
_verify_integrityMethod · 0.45
catsMethod · 0.45
_join_levelMethod · 0.45
describe_numeric_1dFunction · 0.45
describe_timestamp_1dFunction · 0.45
_get_common_dtypeMethod · 0.45

Calls 4

isnaFunction · 0.90
maybe_unbox_numpy_scalarFunction · 0.90
allMethod · 0.45
_reduceMethod · 0.45

Tested by

no test coverage detected