cycquery.ops.ConditionSubstringΒΆ
- class ConditionSubstring(col, substrings, any_=True, not_=False, binarize_col=None, **cond_kwargs)[source]ΒΆ
Bases:
QueryOp
Filter rows on based on having substrings.
Can be specified whether it must have any or all of the specified substrings. This makes no difference when only one substring is provided
- Parameters:
col (
str
) β Column name on which to condition.any β If true, the row must have just one of the substrings. If false, it must have all of the substrings.
not β Take negation of condition.
binarize_col (
Optional
[str
]) β If specified, create a Boolean column of name binarize_col instead of filtering.**cond_kwargs (
Any
) β Optional keyword arguments for processing the condition.
Examples
>>> ConditionSubstring("col1", ["a", "b"])(table) >>> ConditionSubstring("col1", ["a", "b"], any_=False)(table) >>> ConditionSubstring("col1", ["a", "b"], binarize_col="col1_bool")(table)
Methods