pyinterp.dask.descriptive_statistics#
- pyinterp.dask.descriptive_statistics(values, weights=None, axis=None, *, dtype=None)[source]#
Compute descriptive statistics on a dask array.
This function computes statistics (mean, variance, skewness, kurtosis, etc.) on a dask array by processing each block independently and then merging the results.
- Parameters:
values (dask.array.Array) – Input dask array of values.
weights (dask.array.Array | None) – Optional dask array of weights with the same shape as values.
axis (list[int] | None) – Axis or axes along which to compute statistics. If None, statistics are computed over all axes.
dtype (str | type | np.dtype | None) – Data type for computation. Can be “float32”, “float64”, np.float32, np.float64, or None (defaults to float64).
- Returns:
A DescriptiveStatistics instance containing the computed statistics.
- Raises:
ImportError – If dask is not installed.
TypeError – If inputs are not dask arrays.
ValueError – If values and weights have different shapes.
- Return type:
core.DescriptiveStatisticsHolder
Example
>>> import dask.array as da >>> import pyinterp.dask as dask_stats >>> values = da.random.random((10000,), chunks=1000) >>> stats = dask_stats.descriptive_statistics(values) >>> print(f"Mean: {stats.mean():.4f}") >>> print(f"Std: {np.sqrt(stats.variance()):.4f}")