Commit
·
0f3a398
1
Parent(s):
e02c28e
Initial leaderboard setup
Browse files- .ipynb_checkpoints/app-checkpoint.py +14 -1
- app.py +14 -1
.ipynb_checkpoints/app-checkpoint.py
CHANGED
|
@@ -566,9 +566,22 @@ with tab4:
|
|
| 566 |
])
|
| 567 |
|
| 568 |
# Display the styled table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
|
| 570 |
st.dataframe(
|
| 571 |
-
|
| 572 |
use_container_width=True,
|
| 573 |
)
|
| 574 |
# Add visual separator
|
|
|
|
| 566 |
])
|
| 567 |
|
| 568 |
# Display the styled table
|
| 569 |
+
|
| 570 |
+
def color_value(val):
|
| 571 |
+
color = 'green' if val > 0 else 'red' if val < 0 else 'black'
|
| 572 |
+
return f'color: {color}'
|
| 573 |
+
|
| 574 |
+
def highlight_last_column(df):
|
| 575 |
+
return ['font-weight: bold' if col == df.columns[-1] else '' for col in df.columns]
|
| 576 |
+
|
| 577 |
+
styled_df = metric_df.style\
|
| 578 |
+
.apply(lambda x: ['font-weight: bold' if col == metric_df.columns[-1] else '' for col in metric_df.columns])\
|
| 579 |
+
.applymap(color_value)\
|
| 580 |
+
.set_properties(**{'text-align': 'center'})\
|
| 581 |
+
.format(precision=2)
|
| 582 |
|
| 583 |
st.dataframe(
|
| 584 |
+
styled_df,
|
| 585 |
use_container_width=True,
|
| 586 |
)
|
| 587 |
# Add visual separator
|
app.py
CHANGED
|
@@ -566,9 +566,22 @@ with tab4:
|
|
| 566 |
])
|
| 567 |
|
| 568 |
# Display the styled table
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
|
| 570 |
st.dataframe(
|
| 571 |
-
|
| 572 |
use_container_width=True,
|
| 573 |
)
|
| 574 |
# Add visual separator
|
|
|
|
| 566 |
])
|
| 567 |
|
| 568 |
# Display the styled table
|
| 569 |
+
|
| 570 |
+
def color_value(val):
|
| 571 |
+
color = 'green' if val > 0 else 'red' if val < 0 else 'black'
|
| 572 |
+
return f'color: {color}'
|
| 573 |
+
|
| 574 |
+
def highlight_last_column(df):
|
| 575 |
+
return ['font-weight: bold' if col == df.columns[-1] else '' for col in df.columns]
|
| 576 |
+
|
| 577 |
+
styled_df = metric_df.style\
|
| 578 |
+
.apply(lambda x: ['font-weight: bold' if col == metric_df.columns[-1] else '' for col in metric_df.columns])\
|
| 579 |
+
.applymap(color_value)\
|
| 580 |
+
.set_properties(**{'text-align': 'center'})\
|
| 581 |
+
.format(precision=2)
|
| 582 |
|
| 583 |
st.dataframe(
|
| 584 |
+
styled_df,
|
| 585 |
use_container_width=True,
|
| 586 |
)
|
| 587 |
# Add visual separator
|