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.

使用显式标签窗对缓存的 data() 做时间平均。

Delegates to pretty_average() and replaces the internal cache with the returned frame (new index).

委托 pretty_average(),并以返回帧**替换** 内部缓存(新索引)。

Native timestep for center windows is taken from self.resolution (minutes) when set; otherwise passed as None for pretty_average() to infer.

center 窗的原生步长取自 self.resolution``(分钟);未设置时传 ``Nonepretty_average() 推断。

Parameters:
  • freq (str) – Fixed bin frequency (e.g. '1h', '30min'). 固定分箱频率。

  • alignment ({'floor', 'ceiling', 'center'}, optional) – Window alignment (default 'ceiling'). 窗对齐方式(默认 'ceiling')。

  • aggfunc (str or callable, optional) – Aggregation function (default 'mean'). 聚合函数(默认 'mean')。

  • match_ceiling_labels (bool, optional) – When alignment='center', monthly edge trim style (default True, ceiling-like). alignment='center' 时的月界裁剪方式(默认 True,类 ceiling)。

Returns:

One row per output label; also stored as the new cache.

Return type:

pandas.DataFrame

Raises: