class Polars::LazyFrame

def group_by_dynamic(

Other tags:
    Example: Dynamic group by on an index column. -
    Example: Dynamic group bys can also be combined with grouping on normal keys. -
    Example: When closed="both" the time values at the window boundaries belong to 2 groups. -
    Example: When closed="left", should not include right end of interval. -
    Example: The window boundaries can also be added to the aggregation result. -
    Example: Group by windows of 1 hour starting at 2021-12-16 00:00:00. -

Returns:
  • (DataFrame) -

Parameters:
  • start_by ('window', 'datapoint', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday') --
  • group_by (Object) --
  • label ('left', 'right', 'datapoint') --
  • closed ("right", "left", "both", "none") --
  • include_boundaries (Boolean) --
  • offset (Object) --
  • period (Object) --
  • every (Object) --
  • index_column (Object) --
def group_by_dynamic(
  index_column,
  every:,
  period: nil,
  offset: nil,
  include_boundaries: false,
  closed: "left",
  label: "left",
  group_by: nil,
  start_by: "window"
)
  index_column = Utils.parse_into_expression(index_column, str_as_lit: false)
  if offset.nil?
    offset = period.nil? ? "-#{every}" : "0ns"
  end
  if period.nil?
    period = every
  end
  period = Utils.parse_as_duration_string(period)
  offset = Utils.parse_as_duration_string(offset)
  every = Utils.parse_as_duration_string(every)
  rbexprs_by = group_by.nil? ? [] : Utils.parse_into_list_of_expressions(group_by)
  lgb = _ldf.group_by_dynamic(
    index_column,
    every,
    period,
    offset,
    label,
    include_boundaries,
    closed,
    rbexprs_by,
    start_by
  )
  LazyGroupBy.new(lgb)
end