beta_aggregate_timeseries

Aggregating time series data by different time intervals.

beta_aggregate_timeseries(
    data,
    time_column,
    interval,
    columns,
    start_timestamp=None,
    end_timestamp=None
)

Parameters

  • data (pandas.DataFrame or json)

    The data that is being aggregated.

  • time_column (str)

    The name of the column which has the timestamp data.

  • interval (TimeseriesInterval)

    The time interval that is being used to aggregate the data. The values are TimeseriesInterval.HOURLY, TimeseriesInterval.DAILY, TimeseriesInterval.WEEKLY and TimeseriesInterval.MONTHLY

  • columns (List)

    Specify how the data in each column should be aggregated. See ColumnConfig specs.

  • start_timestamp

  • end_timestamp

    To map the time series to a different scale. Assume the data has ranged from 01/10/2021 - 01/25/2021, and you would like the output to be from 01/01/2021 - 01/31/2021. You can pass in start_timestamp:1609459200, end_timestamp:1612051200

Return

The aggregated data is returned in a DataFrame type.

Example

The "Input" tab shows what the example data looks like. It is stored in a variable called "mydata". The "Code" tab shows you the code of how to aggregate the total daily value of the amount column of "mydata". The "Output" tab shows you the aggregated result.

#mydata

index      timestamp       amount         round
0          1628250163000   502.000000     2251
1          1628321616000    80.402445     2252
2          1628286666000   574.475749     2252
...
40         1628352185000   177.423721     2253
41         1628695391000  5000.000000     2257

Last updated

Was this helpful?