cycquery.ops.ConditionEndsWithΒΆ

class ConditionEndsWith(col, string, not_=False, binarize_col=None, **cond_kwargs)[source]ΒΆ

Bases: QueryOp

Filter rows based on ending with some string.

Parameters:
  • col (str) – Column name on which to condition.

  • string (str) – String to end with.

  • 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

>>> ConditionEndsWith("col1", "a")(table)
>>> ConditionEndsWith("col1", "a", binarize_col="col1_bool")(table)

Methods

__call__(table, return_cond=False)[source]ΒΆ

Process the table.

Parameters:
  • table (Union[Select, Subquery, Table, DBTable]) – Table on which to perform the operation.

  • return_cond (bool) – Return the condition instead of filtering.

Returns:

Processed table.

Return type:

sqlalchemy.sql.selectable.Subquery