Spaces:
Running
Running
Ludwig Stumpp
commited on
Commit
·
d80ae2d
1
Parent(s):
205deb7
Option to not filter emptry entries in table
Browse files- streamlit_app.py +7 -5
streamlit_app.py
CHANGED
@@ -214,15 +214,17 @@ def setup_leaderboard(readme: str):
|
|
214 |
|
215 |
st.markdown("## Leaderboard")
|
216 |
modify = st.checkbox("Add filters")
|
|
|
|
|
217 |
if modify:
|
218 |
df_leaderboard = filter_dataframe_by_row_and_columns(df_leaderboard, ignore_columns=NON_BENCHMARK_COLS)
|
219 |
df_leaderboard = filter_dataframe_by_column_values(df_leaderboard)
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
|
227 |
st.dataframe(df_leaderboard)
|
228 |
|
|
|
214 |
|
215 |
st.markdown("## Leaderboard")
|
216 |
modify = st.checkbox("Add filters")
|
217 |
+
clear_empty_entries = st.checkbox("Clear empty entries", value=True)
|
218 |
+
|
219 |
if modify:
|
220 |
df_leaderboard = filter_dataframe_by_row_and_columns(df_leaderboard, ignore_columns=NON_BENCHMARK_COLS)
|
221 |
df_leaderboard = filter_dataframe_by_column_values(df_leaderboard)
|
222 |
|
223 |
+
if clear_empty_entries:
|
224 |
+
df_leaderboard = df_leaderboard.dropna(axis=1, how="all")
|
225 |
+
benchmark_columns = [c for c in df_leaderboard.columns if df_leaderboard[c].dtype == float]
|
226 |
+
rows_wo_any_benchmark = df_leaderboard[benchmark_columns].isna().all(axis=1)
|
227 |
+
df_leaderboard = df_leaderboard[~rows_wo_any_benchmark]
|
228 |
|
229 |
st.dataframe(df_leaderboard)
|
230 |
|