# cf.Data.root_mean_square¶

Data.root_mean_square(axes=None, squeeze=False, mtol=1, weights=None, inplace=False, _preserve_partitions=False)[source]

TODO Collapse axes with their weighted mean.

The weighted mean, $$\mu$$, for array elements $$x_i$$ and corresponding weights elements $$w_i$$ is

$\mu=\frac{\sum w_i x_i}{\sum w_i}$

Missing data array elements and their corresponding weights are omitted from the calculation.

Parameters
axes: (sequence of) int, optional

The axes to be collapsed. By default flattened input is used. Each axis is identified by its integer position. No axes are collapsed if axes is an empty sequence.

squeeze: bool, optional

If True then collapsed axes are removed. By default the axes which are collapsed are left in the result as axes with size 1, meaning that the result is guaranteed to broadcast correctly against the original array.

weights: data-like or dict, optional

Weights associated with values of the array. By default all non-missing elements of the array are assumed to have a weight equal to one. If weights is a data-like object then it must have either the same shape as the array or, if that is not the case, the same shape as the axes being collapsed. If weights is a dictionary then each key is axes of the array (an int or tuple of ints) with a corresponding data-like value of weights for those axes. In this case, the implied weights array is the outer product of the dictionary’s values.

Parameter example:

If weights={1: w, (2, 0): x} then w must contain 1-dimensional weights for axis 1 and x must contain 2-dimensional weights for axes 2 and 0. This is equivalent, for example, to weights={(1, 2, 0), y}, where y is the outer product of w and x. If axes=[1, 2, 0] then weights={(1, 2, 0), y} is equivalent to weights=y. If axes=None and the array is 3-dimensional then weights={(1, 2, 0), y} is equivalent to weights=y.transpose([2, 0, 1]).

mtol: number, optional

inplace: bool, optional

If True then do the operation in-place and return None.

i: deprecated at version 3.0.0

Data or None