File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,16 @@ def print_score(mean: pd.Series, std: pd.Series) -> pd.Series:
3131 mean .loc [(mean < 1e-3 ) & (mean != 0 )] = 1e-3
3232 std .loc [(std < 1e-3 ) & (std != 0 )] = 1e-3
3333
34- mean = mean .round (3 ).astype (str )
35- std = std .round (3 ).astype (str )
34+ # coerce to numeric (empty or object dtypes become float64/NaN)
35+ mean_num = pd .to_numeric (mean , errors = "coerce" )
36+ std_num = pd .to_numeric (std , errors = "coerce" )
3637
37- return mean + " +/- " + std
38+ # round & stringify
39+ mean_str = mean_num .round (3 ).astype (str )
40+ stddev_str = std_num .round (3 ).astype (str )
41+
42+ # if both were empty, this will just return an empty Series
43+ return mean_str + " ± " + stddev_str
3844
3945
4046class Benchmarks :
@@ -363,7 +369,7 @@ def highlight(
363369 means .append (data )
364370
365371 out = pd .concat (means , axis = 1 )
366- out .set_axis (results .keys (), axis = 1 , inplace = True )
372+ out = out .set_axis (list ( results .keys ()) , axis = 1 , copy = False )
367373
368374 bad_highlight = "background-color: lightcoral;"
369375 ok_highlight = "background-color: green;"
You can’t perform that action at this time.
0 commit comments