Fix display precision to 1 decimal
Browse files- src/populate.py +15 -1
src/populate.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import json
|
2 |
import os
|
3 |
import pandas as pd
|
|
|
4 |
|
5 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
6 |
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
@@ -42,10 +43,23 @@ def get_leaderboard_df(results_path: str, requests_path: str, cols: list, benchm
|
|
42 |
df.loc[index, "FinTrade"] = (row["FinTrade"] + 3) / 6
|
43 |
|
44 |
# Now, select the columns that were passed to the function
|
45 |
-
df = df[cols]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
# Filter out if any of the benchmarks have not been produced
|
48 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
|
|
49 |
return raw_data, df
|
50 |
|
51 |
|
|
|
1 |
import json
|
2 |
import os
|
3 |
import pandas as pd
|
4 |
+
import numpy as np
|
5 |
|
6 |
from src.display.formatting import has_no_nan_values, make_clickable_model
|
7 |
from src.display.utils import AutoEvalColumn, EvalQueueColumn
|
|
|
43 |
df.loc[index, "FinTrade"] = (row["FinTrade"] + 3) / 6
|
44 |
|
45 |
# Now, select the columns that were passed to the function
|
46 |
+
df = df[cols]
|
47 |
+
|
48 |
+
# Function to round numeric values, including those in string format
|
49 |
+
def round_numeric(x):
|
50 |
+
try:
|
51 |
+
return round(float(x), 1)
|
52 |
+
except ValueError:
|
53 |
+
return x
|
54 |
+
|
55 |
+
# Apply rounding to all columns except 'T' and 'Model'
|
56 |
+
for col in df.columns:
|
57 |
+
if col not in ['T', 'Model']:
|
58 |
+
df[col] = df[col].apply(round_numeric)
|
59 |
|
60 |
# Filter out if any of the benchmarks have not been produced
|
61 |
df = df[has_no_nan_values(df, benchmark_cols)]
|
62 |
+
|
63 |
return raw_data, df
|
64 |
|
65 |
|