aggregate_idata_time#

pymc_marketing.data.idata.utils.aggregate_idata_time(idata, period, method='sum')[source]#

Aggregate InferenceData over time periods.

Parameters:
idataaz.InferenceData

InferenceData object to aggregate

period{“weekly”, “monthly”, “quarterly”, “yearly”, “all_time”}

Time period to aggregate to. Use “all_time” to aggregate over the entire time dimension (removes the date dimension).

method{“sum”, “mean”}, default “sum”

Aggregation method

Returns:
az.InferenceData

New InferenceData with aggregated groups

Examples

>>> monthly = aggregate_idata_time(idata, "monthly", method="sum")
>>> total = aggregate_idata_time(idata, "all_time", method="sum")