mgkit.filter.lists module

Module used to filter lists

mgkit.filter.lists.aggr_filtered_list(val_list, aggr_func=<function mean>, filt_func=<function <lambda>>)[source]

Aggregate a list of values using ‘aggr_func’ on a list that passed the filtering in ‘filt_func’.

‘filt_func’ is a function that returns True or False for each value in val_list. If the return value is True, the element is included in the values passed to ‘aggr_func’. Internally a list comprehension is used and the result passed to ‘aggr_func’

Parameters:
  • val_list (iterable) – list of values
  • aggr_func (func) – function used to aggregate the list values
  • filt_func (func) – function the return True or False
Returns:

the result of the applied ‘aggr_func’