data_processing
frequenz.lib.notebooks.reporting.data_processing ¤
Microgrid Reporting DataFrame Construction.
This module constructs normalized energy-report DataFrames from raw microgrid telemetry by harmonizing timestamps and column naming, enriching PV flows, adding grid KPIs, and surfacing component-specific metrics used downstream for dashboards.
Functions:¤
- Energy Report DataFrame Construction
- :func:
create_energy_report_df: Builds a normalized energy report table with unified naming, timezone conversion, grid import calculation, and component renaming based on a MicrogridConfig.
Usage:¤
Use create_energy_report_df() inside reporting pipelines or notebooks to transform raw microgrid exports into localized, labeled, and analysis-ready tables for KPIs, dashboards, and stakeholder reporting.
Classes¤
Functions¤
frequenz.lib.notebooks.reporting.data_processing.create_energy_report_df ¤
create_energy_report_df(
df: DataFrame,
component_types: list[str],
mcfg: MicrogridConfig,
mapper: ColumnMapper,
*,
tz_name: str = "Europe/Berlin",
assume_tz: str = "UTC",
fill_missing_values: bool = True,
aggregated_component_config: (
AggregatedComponentConfig | None
) = None
) -> DataFrame
Create a normalized Energy Report DataFrame with selected columns.
Makes a copy of the input, converts the timestamp column to the configured timezone, renames standard columns to unified names, adds the net import column, renames numeric component IDs to labeled names, and returns a reduced DataFrame containing only relevant columns.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Raw input table containing energy data.
TYPE:
|
component_types
|
Component types to include in the Energy Report DataFrame
(e.g., |
mcfg
|
Configuration object used to resolve component IDs.
TYPE:
|
mapper
|
Column Mapper object to standardize the column names.
TYPE:
|
tz_name
|
Target timezone name for timestamp conversion (default: "Europe/Berlin").
TYPE:
|
assume_tz
|
Timezone to assume for naive datetimes before conversion (default: "UTC").
TYPE:
|
fill_missing_values
|
Whether to fill missing aggregate component columns from per-component sums (default: True).
TYPE:
|
aggregated_component_config
|
Optional mapping of component types to aggregated
column metadata used when filling missing aggregates. Defaults to the shared
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
The Energy Report DataFrame with standardized and selected columns. |
Notes
Component IDs are renamed to labeled names via label_component_columns().
Source code in src/frequenz/lib/notebooks/reporting/data_processing.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |