Roni Goldshmidt
commited on
Commit
·
3a57b4b
1
Parent(s):
0f3a398
Initial leaderboard setup
Browse files- .ipynb_checkpoints/app-checkpoint.py +10 -3
- app.py +10 -3
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -568,14 +568,20 @@ with tab4:
|
|
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(
|
575 |
-
return
|
|
|
|
|
|
|
|
|
576 |
|
577 |
styled_df = metric_df.style\
|
578 |
-
.apply(
|
579 |
.applymap(color_value)\
|
580 |
.set_properties(**{'text-align': 'center'})\
|
581 |
.format(precision=2)
|
@@ -584,6 +590,7 @@ with tab4:
|
|
584 |
styled_df,
|
585 |
use_container_width=True,
|
586 |
)
|
|
|
587 |
# Add visual separator
|
588 |
st.markdown("---")
|
589 |
|
|
|
568 |
# Display the styled table
|
569 |
|
570 |
def color_value(val):
|
571 |
+
if not isinstance(val, (int, float)):
|
572 |
+
return ''
|
573 |
color = 'green' if val > 0 else 'red' if val < 0 else 'black'
|
574 |
return f'color: {color}'
|
575 |
|
576 |
+
def highlight_last_column(data):
|
577 |
+
return pd.DataFrame(
|
578 |
+
[[''] * (len(data.columns)-1) + ['font-weight: bold']],
|
579 |
+
index=[0],
|
580 |
+
columns=data.columns
|
581 |
+
).iloc[0]
|
582 |
|
583 |
styled_df = metric_df.style\
|
584 |
+
.apply(highlight_last_column, axis=1)\
|
585 |
.applymap(color_value)\
|
586 |
.set_properties(**{'text-align': 'center'})\
|
587 |
.format(precision=2)
|
|
|
590 |
styled_df,
|
591 |
use_container_width=True,
|
592 |
)
|
593 |
+
|
594 |
# Add visual separator
|
595 |
st.markdown("---")
|
596 |
|
app.py
CHANGED
@@ -568,14 +568,20 @@ with tab4:
|
|
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(
|
575 |
-
return
|
|
|
|
|
|
|
|
|
576 |
|
577 |
styled_df = metric_df.style\
|
578 |
-
.apply(
|
579 |
.applymap(color_value)\
|
580 |
.set_properties(**{'text-align': 'center'})\
|
581 |
.format(precision=2)
|
@@ -584,6 +590,7 @@ with tab4:
|
|
584 |
styled_df,
|
585 |
use_container_width=True,
|
586 |
)
|
|
|
587 |
# Add visual separator
|
588 |
st.markdown("---")
|
589 |
|
|
|
568 |
# Display the styled table
|
569 |
|
570 |
def color_value(val):
|
571 |
+
if not isinstance(val, (int, float)):
|
572 |
+
return ''
|
573 |
color = 'green' if val > 0 else 'red' if val < 0 else 'black'
|
574 |
return f'color: {color}'
|
575 |
|
576 |
+
def highlight_last_column(data):
|
577 |
+
return pd.DataFrame(
|
578 |
+
[[''] * (len(data.columns)-1) + ['font-weight: bold']],
|
579 |
+
index=[0],
|
580 |
+
columns=data.columns
|
581 |
+
).iloc[0]
|
582 |
|
583 |
styled_df = metric_df.style\
|
584 |
+
.apply(highlight_last_column, axis=1)\
|
585 |
.applymap(color_value)\
|
586 |
.set_properties(**{'text-align': 'center'})\
|
587 |
.format(precision=2)
|
|
|
590 |
styled_df,
|
591 |
use_container_width=True,
|
592 |
)
|
593 |
+
|
594 |
# Add visual separator
|
595 |
st.markdown("---")
|
596 |
|