cycquery.ops.SubstringΒΆ

class Substring(col, start_index, stop_index, new_col_label=None)[source]ΒΆ

Bases: QueryOp

Get substring of a string column.

Parameters:
  • col (str) – Name of column which has string, where substring needs to be extracted.

  • start_index (int) – Start index of substring.

  • stop_index (int) – Stop index of substring.

  • new_col_name – Name of the new column with extracted substring.

Examples

>>> Substring("col1", 0, 2, "col1_substring")(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