bsrn.dataset.BSRNDataset.average#
- BSRNDataset.average(freq, alignment='ceiling', aggfunc='mean', match_ceiling_labels=True)[source]#
Time-average the cached
data()with explicit labeled windows.Delegates to
pretty_average()and replaces the internal cache with the returned frame (new index).Native timestep for center windows is taken from
self.resolution(minutes) when set; otherwise passed asNoneforpretty_average()to infer.- Parameters:
freq (str) – Fixed bin frequency (e.g.
'1h','30min').alignment ({'floor', 'ceiling', 'center'}, optional) – Window alignment (default
'ceiling').aggfunc (str or callable, optional) – Aggregation function (default
'mean').match_ceiling_labels (bool, optional) – When
alignment='center', monthly edge trim style (defaultTrue, ceiling-like).
- Returns:
One row per output label; also stored as the new cache.
- Return type:
- Raises:
TypeError – If
data().indexis not aDatetimeIndex.ValueError – Propagated from
pretty_average()whenfreqis not a fixed frequency.