std

std(a, axis=None, ddof=0, *, return_mean=False, validate=True)

Return the standard deviation with NaN/inf propagation.

Parameters

a : array_like

Input data. Supported numeric inputs are normalized to a contiguous kernel array when validate=True. Computed reducers promote integer and bool inputs to float64; exact selection reducers keep integer and bool dtypes where the selected value can be returned exactly. Complex and object arrays are not supported.

axis : None, 0, -1, or int = None

Axis to reduce. None reduces the whole array. 0 reduces strided reducing-axis slices into the remaining shape. -1 and ndim - 1 reduce contiguous slices. Other axes raise NotImplementedError.

ddof : int = 0

Delta degrees of freedom. Results with nvalid <= ddof are NaN.

return_mean : bool = False

If True, return (standard_deviation, mean). For axis=None this reuses the mean already computed by the variance kernel.

validate : bool = True

If True, check dtype, dimensionality, contiguity, and axis validity before entering the Rust kernel. If False, the caller must provide a contiguous supported kernel dtype (float32, float64, bool, or a NumPy integer dtype). validate=False skips dtype promotion: integer and bool arrays are reduced directly, while complex and object arrays remain unsupported.

Returns

out : float or ndarray

Reduction result. axis=None returns a Python float. Axis reductions return an array with the reduced axis removed.

Notes

Plain reducers include every value, so NaN and inf propagate with IEEE / NumPy-like semantics. This is the fastest path for known-clean finite data.