Skip to content

Commit 3efefcb

Browse files
Update src/frequenz/lib/notebooks/reporting/data_processing.py
Co-authored-by: Copilot <[email protected]> Signed-off-by: flora-hofmann-frequenz <[email protected]>
1 parent 3625b42 commit 3efefcb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/frequenz/lib/notebooks/reporting/data_processing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def convert_timezone(df: pd.DataFrame) -> pd.DataFrame:
105105
A copy of the DataFrame with localized timezone.
106106
"""
107107
df = df.copy()
108-
assert COLUMN_TIMESTAMP in df.columns, df
108+
if COLUMN_TIMESTAMP not in df.columns:
109+
raise KeyError(f"Missing required column '{COLUMN_TIMESTAMP}' in DataFrame.")
109110
if df[COLUMN_TIMESTAMP].dt.tz is None:
110111
df[COLUMN_TIMESTAMP] = df[COLUMN_TIMESTAMP].dt.tz_localize("UTC")
111112
df[COLUMN_TIMESTAMP] = df[COLUMN_TIMESTAMP].dt.tz_convert(TZ_NAME)

0 commit comments

Comments
 (0)