neuralset.events.transforms.basic.CreateColumn

class neuralset.events.transforms.basic.CreateColumn(*, infra: Backend | None = None, column: str, query_row: Annotated[str, AfterValidator(func=validate_query)], default_value: Any = None, query_value: Any = None, query_column_name: str | None = None, on_column_exists: Literal['raise', 'warn', 'ignore'] = 'raise')[source][source]

Create a new column with a default value, and optionally update selected rows via a query.

Parameters:
  • column (str) – Name of the column to create.

  • query_row (Query) – A pandas query string to select rows to update (see base.Query).

  • default_value (Any) – Default value to assign to all rows. If None, the column will not be initialized and only the rows selected by the query will be assigned the values from the query_column_name column.

  • query_value (Any) – Value to assign to rows selected by the query.

  • query_column_name (str | None) – If provided instead of query_value, the rows selected by the query will be assigned the values from this column.

  • on_column_exists (Literal["raise", "warn", "ignore"]) – Behavior if the column already exists.