sensortoolkit.datetime_utils._time_averaging.object_grouper
- object_grouper(series, number_threshold)[source]
Group columns of type object by the mode of values within each averaging interval.
- Parameters
series (pandas Series) – An array of values with type object (typically textual information) alongside an associated datetime index.
number_threshold (int or float) – The number of counts for the modal value within a given averaging interval required to assign the modal value to the averaging interval. This can be expressed as a completeness threshold (typically 70%) multiplied by the number of expected counts within a given averaging interval.
- Returns
The mode of the object-type series within the specified averaging interval. If the number of counts for the modal value is less than the number threshold (70% x expected counts within an averaging interval), return numpy.nan (null).
- Return type
val (str or numpy.nan)