perda.core_data_structures.masking#

class perda.core_data_structures.masking.FilterOptions(*values)[source]#

Bases: Enum

Specifies which array(s) a filter function receives as input.

BOTH = 'both'#
TIMESTAMPS = 'right_only'#
VALUES = 'left_only'#
perda.core_data_structures.masking.apply_ufunc_filter(data, filter_func, apply_to=FilterOptions.VALUES)[source]#

Apply a filter function to a DataInstance.

Parameters:
  • data (DataInstance) – Input DataInstance

  • filter_func (Callable) – Function that takes in values and/or timestamps and returns a boolean mask

  • apply_to (FilterOptions, optional) – Whether to apply the filter to values, timestamps, or both. Default is values

Returns:

Filtered DataInstance

Return type:

DataInstance