We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3625b42 commit 3efefcbCopy full SHA for 3efefcb
src/frequenz/lib/notebooks/reporting/data_processing.py
@@ -105,7 +105,8 @@ def convert_timezone(df: pd.DataFrame) -> pd.DataFrame:
105
A copy of the DataFrame with localized timezone.
106
"""
107
df = df.copy()
108
- assert COLUMN_TIMESTAMP in df.columns, df
+ if COLUMN_TIMESTAMP not in df.columns:
109
+ raise KeyError(f"Missing required column '{COLUMN_TIMESTAMP}' in DataFrame.")
110
if df[COLUMN_TIMESTAMP].dt.tz is None:
111
df[COLUMN_TIMESTAMP] = df[COLUMN_TIMESTAMP].dt.tz_localize("UTC")
112
df[COLUMN_TIMESTAMP] = df[COLUMN_TIMESTAMP].dt.tz_convert(TZ_NAME)
0 commit comments