cycquery.ops.AddDeltaColumnΒΆ

class AddDeltaColumn(add_to, negative=False, new_col_labels=None, **delta_kwargs)[source]ΒΆ

Bases: QueryOp

Construct and add an interval column to some columns.

Parameters:
  • add_to (Union[str, List[str]]) – Column names specifying to which columns is being added.

  • negative (Optional[bool]) – Subtract the object rather than adding.

  • new_col_labels (Union[str, List[str], None]) – If specified, create new columns with these labels. Otherwise, apply the function to the existing columns.

  • **delta_kwargs (Any) – The arguments used to create the Interval column.

Examples

>>> AddDeltaColumn("col1", "col2")(table)
>>> AddDeltaColumn(["col1", "col2"], "col3")(table)
>>> AddDeltaColumn("col1", "col2", negative=True)(table)
>>> AddDeltaColumn("col1", "col2", "col1_plus_col2")(table)

Methods

__call__(table)[source]ΒΆ

Process the table.

Parameters:

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

Returns:

Processed table.

Return type:

sqlalchemy.sql.selectable.Subquery