semantique.processor.reducers.n_

Contents

semantique.processor.reducers.n_#

semantique.processor.reducers.n_(x, track_types=True, **kwargs)[source]#

Return the number of observations in a set.

Parameters:
  • x (xarray.DataArray) – The array to be reduced.

  • track_types (bool) – Should the reducer promote the value type of the output object, based on the value type of the input object?

  • **kwargs – Additional keyword arguments. If the reducer has to be applied to a specific dimension, the keyword argument “dim” with as value the name of the targeted dimension should be specified here.

Returns:

xarray.DataArray – The reduced array.

Note

Missing values in x are ignored. That means that this reducer will return the number of non-null values in the set. If all values in the set are null, it returns 0.

Note

When tracking value types, this reducer uses the following type promotion manual, with the keys being the supported value types of x, and the corresponding value being the promoted value type of the output.

{'binary': 'discrete', 'continuous': 'discrete', 'discrete': 'discrete', 'nominal': 'discrete', 'ordinal': 'discrete', 'coords': 'discrete', 'datetime': 'discrete'}