milia.features.multires#

Multi-resolution consumption features: daily, weekly and monthly totals and their changes.

Functions

extract(pivot[, levels, diffs])

Totals at several resolutions, optionally with their period-on-period changes.

milia.features.multires.extract(pivot, levels=('D', 'W', 'ME'), diffs=True)#

Totals at several resolutions, optionally with their period-on-period changes.

Daily totals are resampled to each coarser level, so every level sums the same days. The result describes a meter’s year at once in detail and in outline.

Parameters:
  • pivot (DataFrame) – Meter pivot.

  • levels (tuple[str, ...]) – Pandas frequencies, finest first; the first must be daily or finer.

  • diffs (bool) – Also append each level’s first difference (first value zero).

Return type:

DataFrame

Returns:

One row per meter; columns are named <level><index> and d<level><index>.

Examples

>>> from milia.data import synthetic
>>> pivot = synthetic.generate(meters=3, days=14, steps=24).pivot
>>> extract(pivot, levels=("D", "W")).shape
(3, 32)