Skip to content

Commit 05b077b

Browse files
committed
better error message
1 parent 435e500 commit 05b077b

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
@@ -276,7 +276,10 @@ def measure_inference(fct, X, repeat, max_time=5, quantile=1):
276276
try:
277277
piv = subdf.pivot(index="max_depth", columns="name", values=["avg", "med"])
278278
except Exception as e:
279-
raise AssertionError(str(subdf)) from e
279+
from io import StringIO
280+
st = StringIO()
281+
subdf.to_csv(st, index=False)
282+
raise AssertionError(st.getvalue()) from e
280283
piv.plot(ax=ax, title=f"jobs={n_j}, trees={n_estimators}")
281284
ax.set_ylabel(f"n_jobs={n_j}", fontsize="small")
282285
ax.set_xlabel("max_depth", fontsize="small")

0 commit comments

Comments
 (0)