Skip to content

innovate.aggregate_weekly

All current Python definitions

View source · Source file SHA-256: 522871fe0b61b840b5f85b8f278beb2b79c7afd68645265ae3a68983d56d74e4

def aggregate_weekly(
data: pl.DataFrame | pl.LazyFrame,
value_columns: list[str],
*,
time_column: str = 'time',
) -> pl.DataFrame: ...

Sum observations into 168-hour windows anchored at the earliest timestamp.

  • data: Polars frame with non-null Date or Datetime timestamps; lazy input is collected and observations are sorted before grouping.
  • value_columns: Nonempty list of distinct numeric columns to sum.
  • time_column: Timestamp column name; defaults to "time".

Table of left-labelled weekly windows and value sums. Empty weekly windows are not inserted; the anchor is a data timestamp, not a calendar weekday.

  • ValueError: If timestamps or value-column selections violate the aggregate_time_series validation rules.
  • polars.exceptions.PolarsError: If columns are missing or grouping fails.