TimeFrame.encode_flag_column

TimeFrame.encode_flag_column(flag_column_name)[source]

Encode a decoded flag column back to raw values.

For BitwiseFlagColumn: replaces the List(String) column back to a bitwise integer column. Each flag name in the list contributes its bit value; an empty list produces 0.

For CategoricalFlagColumn in scalar mode: replaces each flag name with its original value (e.g. "good" -> 123).

For CategoricalFlagColumn in list mode: replaces each flag name in the list with its original value.

Parameters:

flag_column_name (str) – Name of the registered decoded flag column to encode.

Return type:

TimeFrame

Returns:

A new TimeFrame with the flag column replaced by its encoded form.

Raises:
  • ColumnNotFoundError – If flag_column_name is not a registered flag column.

  • ColumnTypeError – If the flag column is not in decoded form.

  • BitwiseFlagUnknownError – If a bitwise column contains any flag name not in the flag system.

  • CategoricalFlagUnknownError – If a categorical column contains any flag name not in the flag system.