Spaces:
Running
Running
Ludwig Stumpp
commited on
Commit
·
7adf431
1
Parent(s):
8658420
Check for bool dtype at table filter
Browse files- streamlit_app.py +7 -2
streamlit_app.py
CHANGED
|
@@ -4,7 +4,8 @@ from collections.abc import Iterable
|
|
| 4 |
|
| 5 |
import pandas as pd
|
| 6 |
import streamlit as st
|
| 7 |
-
from pandas.api.types import is_datetime64_any_dtype,
|
|
|
|
| 8 |
|
| 9 |
GITHUB_URL = "https://github.com/LudwigStumpp/llm-leaderboard"
|
| 10 |
|
|
@@ -142,7 +143,11 @@ def filter_dataframe_by_column_values(df: pd.DataFrame) -> pd.DataFrame:
|
|
| 142 |
left, right = st.columns((1, 20))
|
| 143 |
|
| 144 |
for column in to_filter_columns:
|
| 145 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
_min = float(df[column].min())
|
| 147 |
_max = float(df[column].max())
|
| 148 |
|
|
|
|
| 4 |
|
| 5 |
import pandas as pd
|
| 6 |
import streamlit as st
|
| 7 |
+
from pandas.api.types import (is_bool_dtype, is_datetime64_any_dtype,
|
| 8 |
+
is_numeric_dtype)
|
| 9 |
|
| 10 |
GITHUB_URL = "https://github.com/LudwigStumpp/llm-leaderboard"
|
| 11 |
|
|
|
|
| 143 |
left, right = st.columns((1, 20))
|
| 144 |
|
| 145 |
for column in to_filter_columns:
|
| 146 |
+
if is_bool_dtype(df[column]):
|
| 147 |
+
user_bool_input = right.checkbox(f"{column}", value=True)
|
| 148 |
+
df = df[df[column] == user_bool_input]
|
| 149 |
+
|
| 150 |
+
elif is_numeric_dtype(df[column]):
|
| 151 |
_min = float(df[column].min())
|
| 152 |
_max = float(df[column].max())
|
| 153 |
|