Spaces:
Restarting
Restarting
Madhavan Iyengar
commited on
Commit
·
a6073db
1
Parent(s):
f370751
try to get decimal points
Browse files
app.py
CHANGED
@@ -52,8 +52,21 @@ except Exception:
|
|
52 |
|
53 |
raw_data, original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
54 |
leaderboard_df = original_df.copy()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
numeric_cols = [col for col in leaderboard_df.columns if leaderboard_df[col].dtype in ['float64', 'float32']]
|
56 |
-
leaderboard_df[numeric_cols] = leaderboard_df[numeric_cols].applymap(
|
57 |
|
58 |
(
|
59 |
finished_eval_queue_df,
|
|
|
52 |
|
53 |
raw_data, original_df = get_leaderboard_df(EVAL_RESULTS_PATH, EVAL_REQUESTS_PATH, COLS, BENCHMARK_COLS)
|
54 |
leaderboard_df = original_df.copy()
|
55 |
+
|
56 |
+
def custom_format(x):
|
57 |
+
if pd.isna(x):
|
58 |
+
return x # Return as is if NaN
|
59 |
+
try:
|
60 |
+
float_x = float(x)
|
61 |
+
if float_x.is_integer():
|
62 |
+
return f"{int(float_x)}"
|
63 |
+
else:
|
64 |
+
return f"{float_x:.2f}".rstrip('0').rstrip('.')
|
65 |
+
except ValueError:
|
66 |
+
return x # Return as is if conversion to float fails
|
67 |
+
|
68 |
numeric_cols = [col for col in leaderboard_df.columns if leaderboard_df[col].dtype in ['float64', 'float32']]
|
69 |
+
leaderboard_df[numeric_cols] = leaderboard_df[numeric_cols].applymap(custom_format)
|
70 |
|
71 |
(
|
72 |
finished_eval_queue_df,
|