torcharrow.DataFrame.filter¶
- DataFrame.filter(predicate: Union[Callable, Iterable], columns: Optional[List[str]] = None)¶
Select rows where predicate is True. Different from Pandas. Use keep for Pandas filter.
- Parameters:
iterable (predicate - callable or) – A predicate function or iterable of booleans the same length as the column. If an n-ary predicate, use the columns parameter to provide arguments.
names (columns - list of string) – Which columns to invoke the filter with. If None, apply to all columns.
None (default) – Which columns to invoke the filter with. If None, apply to all columns.
Examples
>>> ta.column([1,2,3,4]).filter([True, False, True, False]) == ta.column([1,2,3,4]).filter(lambda x: x%2==1) 0 1 1 1 dtype: boolean, length: 2, null_count: 0