Spaces:
Running
Running
Commit
·
f68b9ef
1
Parent(s):
e7d19a9
feat: format numeric columns in app.py to display up to 4 decimal places for improved data presentation
Browse files
app.py
CHANGED
|
@@ -102,6 +102,11 @@ else:
|
|
| 102 |
# If no sort column found, just keep original order
|
| 103 |
pass
|
| 104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
with gr.Blocks("ParityError/Interstellar", fill_width=True, css=custom_css) as demo:
|
| 106 |
gr.HTML(
|
| 107 |
"""
|
|
|
|
| 102 |
# If no sort column found, just keep original order
|
| 103 |
pass
|
| 104 |
|
| 105 |
+
# Format numeric columns to have at most 4 decimal places
|
| 106 |
+
numeric_cols = df.select_dtypes(include=[float, int]).columns.tolist()
|
| 107 |
+
for col in numeric_cols:
|
| 108 |
+
df[col] = df[col].apply(lambda x: round(x, 4) if pd.notna(x) else x)
|
| 109 |
+
|
| 110 |
with gr.Blocks("ParityError/Interstellar", fill_width=True, css=custom_css) as demo:
|
| 111 |
gr.HTML(
|
| 112 |
"""
|