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

Method _mode

pandas/core/arrays/base.py:2678–2697  ·  view source on GitHub ↗

Returns the mode(s) of the ExtensionArray. Always returns `ExtensionArray` even if only one value. Parameters ---------- dropna : bool, default True Don't consider counts of NA values. Returns ------- same type as self

(self, dropna: bool = True)

Source from the content-addressed store, hash-verified

2676 return type(self)._from_sequence(res_values)
2677
2678 def _mode(self, dropna: bool = True) -> Self:
2679 """
2680 Returns the mode(s) of the ExtensionArray.
2681
2682 Always returns `ExtensionArray` even if only one value.
2683
2684 Parameters
2685 ----------
2686 dropna : bool, default True
2687 Don't consider counts of NA values.
2688
2689 Returns
2690 -------
2691 same type as self
2692 Sorted, if possible.
2693 """
2694 # error: Incompatible return value type (got "Union[ExtensionArray,
2695 # Tuple[np.ndarray, npt.NDArray[np.bool_]]", expected "Self")
2696 result, _ = mode(self, dropna=dropna)
2697 return result # type: ignore[return-value]
2698
2699 def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs):
2700 if any(

Callers 2

modeMethod · 0.45
modeFunction · 0.45

Calls 1

modeFunction · 0.90

Tested by

no test coverage detected