spiketools.utils.base.select_from_list¶
- spiketools.utils.base.select_from_list(lst, select)[source]¶
Select elements from a list based on a boolean mask.
- Parameters:
- lstlist
A list of values to select from.
- selectlist of bool
Indicator for which elements to select.
- Returns:
- lst
Selected elements from the list.
Examples
Select the first and last element from given list:
>>> lst = [1, 4, 3, 6, 8] >>> select = [True, False, False, False, True] >>> select_from_list(lst, select) [1, 8]