Data Aggregation

Bubbletea offers 2 convenient methods to aggregate data into buckets.

  1. beta_agregate_timeseries Process time series data by hour, day, week or month.

  2. beta_aggregate_groupby Group data by a field.

As a developer, you need to specify how each data column is aggregated through the definition below.

ColumnConfig

Specify how each column is aggregated.

ColumnConfig:
        name: str
        aggregate_method: AggregateMethod
        type:ColumnType=None
        na_fill_method: NaInterpolationMethod = None,
        na_fill_value=None
  • name: str

    The name of the column.

  • aggregate_method

    Choose from any of AggregateMethod.

    class AggregateMethod(str, Enum):
        MEAN = ("mean",)
        SUM = ("sum",)
        FIRST = ("first",)
        LAST = ("last",)
        MEDIAN = ("median",)
        MIN = ("min",)
        MAX = ("max",)
        COUNT = "count"
  • na_fill_method: NaInterpolationMethod

    By applying the aggregate_method, NA could be generated usually because of a lack of data. Choose one of NaInterpolationMethod

    • FORDWARD_FILL

      Fill NA with the previous value.

    • BACKWARD_FILL

      Fill NA backward.

      class NaInterpolationMethod(str, Enum):
          FORDWARD_FILL = ("ffill",)
          BACKWARD_FILL = ("bfill",)
  • na_fill_value

    NA can be filled with literal value as well, for example 0. na_fill_method triumphs na_fill_value

Last updated

Was this helpful?