aggregate_idata_time#
- pymc_marketing.data.idata.utils.aggregate_idata_time(idata, period, method='sum')[source]#
Aggregate InferenceData over time periods.
- Parameters:
- idata
az.InferenceData InferenceData object to aggregate
- period{“original”, “weekly”, “monthly”, “quarterly”, “yearly”, “all_time”}
Time period to aggregate to. Use “original” for no aggregation (returns unchanged), “all_time” to aggregate over the entire time dimension (removes the date dimension).
- method{“sum”, “mean”}, default “sum”
Aggregation method
- idata
- Returns:
az.InferenceDataNew InferenceData with aggregated groups (or unchanged if period=”original”)
Examples
>>> original = aggregate_idata_time(idata, "original") # No aggregation >>> monthly = aggregate_idata_time(idata, "monthly", method="sum") >>> total = aggregate_idata_time(idata, "all_time", method="sum")