smallpond.dataframe.DataFrame.filter#
- DataFrame.filter(sql_or_func: str | Callable[[Dict[str, Any]], bool], **kwargs) DataFrame #
Filter out rows that don’t satisfy the given predicate.
Parameters#
- sql_or_func
A SQL expression or a predicate function. For functions, it should take a dictionary of columns as input and returns a boolean. SQL expression is preferred as it’s more efficient.
Examples#
df = df.filter('a > 1') df = df.filter(lambda r: r['a'] > 1)