Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 9f28c5c

Browse files
committed
try/except for plot train/test
1 parent 1bd34a5 commit 9f28c5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

river_dl/postproc_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ def plot_obs(prepped_data, variable, outfile, partition='trn'):
417417
_, seg_var = get_var_names(variable)
418418
df_piv = df.pivot(index="date", columns="seg_id_nat", values=seg_var)
419419
df_piv.dropna(axis=1, how="all", inplace=True)
420-
if not df.empty:
420+
try:
421421
df_piv.plot(subplots=True, figsize=(8, 12))
422-
else:
422+
except TypeError:
423423
fig, ax = plt.subplots()
424424
ax.text(0.5, 0.5, 'NO DATA')
425425
plt.tight_layout()

0 commit comments

Comments
 (0)