Skip to content

Commit 355cf1f

Browse files
sdpythonCopilot
andauthored
Update _doc/examples/ml/plot_template_data.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d6b559e commit 355cf1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

_doc/examples/ml/plot_template_data.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,14 @@ def compute_oracle(table, cible):
7272
columns="Session",
7373
values=cible,
7474
)
75-
# .dropna(axis=0) # fails
7675
.sort_index()
7776
)
77+
# Keep only rows where both 2024 and 2025 have non-missing values
78+
piv = piv.dropna(axis=0, how="any")
79+
if piv.empty:
80+
raise ValueError(
81+
"Not enough overlapping data between 2024 and 2025 to compute oracle."
82+
)
7883
return mean_absolute_error(piv[2025], piv[2024])
7984

8085

0 commit comments

Comments
 (0)