Skip to content

Commit 435e500

Browse files
committed
catch an error
1 parent 6d8d571 commit 435e500

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

_doc/examples/plot_benchmark_rf.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
273273
subdf = df[(df.n_estimators == n_estimators) & (df.n_jobs == n_j)]
274274
if subdf.shape[0] == 0:
275275
continue
276-
piv = subdf.pivot(index="max_depth", columns=["name"], values=["avg", "med"])
276+
try:
277+
piv = subdf.pivot(index="max_depth", columns="name", values=["avg", "med"])
278+
except Exception as e:
279+
raise AssertionError(str(subdf)) from e
277280
piv.plot(ax=ax, title=f"jobs={n_j}, trees={n_estimators}")
278281
ax.set_ylabel(f"n_jobs={n_j}", fontsize="small")
279282
ax.set_xlabel("max_depth", fontsize="small")

0 commit comments

Comments
 (0)