weighted_median#
- caput.algorithms.median.weighted_median(A: numpy.typing.NDArray[numpy.int_ | numpy.float64], W: numpy.typing.NDArray[numpy.int_ | numpy.float64], method: Literal['lower', 'higher', 'split'] = 'split') numpy.ndarray[numpy.floating | numpy.integer] | numpy.integer | numpy.floating[source]#
Calculate the weighted median of a set of data.
The weighted median is always calculated along the last axis.
See quantile for more information on the behaviour for some special cases.
- Parameters:
- Returns:
- medianarray_like
The calculated median. This has the same shape as A with the last axis removed. If A was one dimensional the value returned is a scalar.