TimeFrame.init_flag_column

TimeFrame.init_flag_column(flag_system_name, column_name=None, data=None)[source]

Add a new column to the TimeFrame DataFrame, setting it as a Flag Column.

For bitwise flag systems, the column is initialised with integer values (default 0). For CategoricalSingleFlag systems, the column is initialised with null values. For CategoricalListFlag systems, the column is initialised with empty lists.

Parameters:
  • flag_system_name (str) – The name of the registered flag system.

  • column_name (str | None) – Optional name for the new flag column. If omitted, a name of the form __flag__{flag_system_name} is used, with an integer suffix appended if the name already exists (e.g. __flag__CORE_FLAGS__1).

  • data (Union[int, str, Sequence[int | str], None]) – The default value(s) to populate the flag column with. Can be a scalar or list-like. For bitwise systems defaults to 0; for categorical systems defaults to None (null) in single mode or an empty list in list mode.

Return type:

None