seismometer.data.cohorts.label_cohorts_categorical

seismometer.data.cohorts.label_cohorts_categorical(series, cat_values=None)

Bin a categorical series of data, reduced to a set of category values.

Parameters:
  • series (SeriesOrArray) – pandas series of data to bin.

  • cat_values (Optional[list], optional) – List of categories to reduce to (default: None-> all observed categories).

Returns:

  • np.array of ints indicating the bin index for each value in the input series.

  • List of string labels for each bin; which is the list of categories.

Return type:

Tuple[Series, list[str]]