TimeFrame.filter_by_flag

TimeFrame.filter_by_flag(flag_column_name, flag, include=True)[source]

Return a new TimeFrame filtered to rows that have (or lack) specific flags set.

For bitwise flag columns, a row matches if any of the given flags are set (bitwise OR check). For categorical flag columns, a row matches if its value (or any list element in list mode) is any of the given flag values.

Parameters:
  • flag_column_name (str) – The name of the registered flag column to filter on.

  • flag (int | str | list[int | str]) – One or more flag names or values to filter against.

  • include (bool) – Whether to keep only rows that have the flag(s) (True) or keep only rows that do not have the flag(s) (False)

Return type:

TimeFrame

Returns:

A new TimeFrame containing only the rows that satisfy the filter condition.