scipy.special.boxcox — SciPy v1.15.2 Manual (original) (raw)
scipy.special.boxcox(x, lmbda, out=None) = <ufunc 'boxcox'>#
Compute the Box-Cox transformation.
The Box-Cox transformation is:
y = (x**lmbda - 1) / lmbda if lmbda != 0 log(x) if lmbda == 0
Returns nan if x < 0
. Returns -inf if x == 0
and lmbda < 0
.
Parameters:
xarray_like
Data to be transformed.
lmbdaarray_like
Power parameter of the Box-Cox transform.
outndarray, optional
Optional output array for the function values
Returns:
yscalar or ndarray
Transformed data.
Notes
Added in version 0.14.0.
Examples
from scipy.special import boxcox boxcox([1, 4, 10], 2.5) array([ 0. , 12.4 , 126.09110641]) boxcox(2, [0, 1, 2]) array([ 0.69314718, 1. , 1.5 ])