Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -74,19 +74,31 @@ class_values = ['None'] + list(df['class'].unique())
|
|
74 |
star_values = ['None'] + list(df['star'].unique())
|
75 |
color_values = ['None'] + list(df['color'].unique())
|
76 |
speed_values = ['None'] + list(df['speed'].unique())
|
|
|
77 |
|
78 |
#########################################
|
79 |
## Select options
|
80 |
-
##
|
81 |
|
82 |
with st.sidebar:
|
|
|
|
|
83 |
# star_option = st.selectbox(label='Speed:', options=star_values, index=5)
|
84 |
color_option = st.selectbox(label='Color:', options=color_values, index=0)
|
85 |
speed_option = st.selectbox(label='Speed:', options=speed_values, index=0)
|
86 |
class_option = st.selectbox(label='Class:', options=class_values, index=0)
|
|
|
87 |
special_type_option = st.text_input(label="SpecialSkill Category", value="Hit 3")
|
88 |
special_text_option = st.text_input(label="SpecialSkill Text", value="Dispel")
|
|
|
|
|
|
|
|
|
89 |
idx_all = []
|
|
|
|
|
|
|
|
|
90 |
# if star_option is not None:
|
91 |
# idx_all.append(filter_by_1col(df, 'star', star_option, exact_flag=False))
|
92 |
|
@@ -99,6 +111,10 @@ if color_option != 'None':
|
|
99 |
if class_option != 'None':
|
100 |
idx_all.append(filter_by_1col(df, 'class', class_option, exact_flag=False))
|
101 |
|
|
|
|
|
|
|
|
|
102 |
if special_type_option != '':
|
103 |
idx_all.append(filter_by_1col(df, 'types', special_type_option, exact_flag=False))
|
104 |
|
@@ -109,4 +125,4 @@ if special_text_option != '':
|
|
109 |
|
110 |
df2 = df[np.all(idx_all,axis=0)]
|
111 |
|
112 |
-
display_heroes_from_df(df2.sort_values(
|
|
|
74 |
star_values = ['None'] + list(df['star'].unique())
|
75 |
color_values = ['None'] + list(df['color'].unique())
|
76 |
speed_values = ['None'] + list(df['speed'].unique())
|
77 |
+
source_values = ['None'] + list(df['source'].unique())
|
78 |
|
79 |
#########################################
|
80 |
## Select options
|
81 |
+
## TODO: family, costume
|
82 |
|
83 |
with st.sidebar:
|
84 |
+
st.title('Filter Options')
|
85 |
+
name_option = st.text_input(label="Name:", value="")
|
86 |
# star_option = st.selectbox(label='Speed:', options=star_values, index=5)
|
87 |
color_option = st.selectbox(label='Color:', options=color_values, index=0)
|
88 |
speed_option = st.selectbox(label='Speed:', options=speed_values, index=0)
|
89 |
class_option = st.selectbox(label='Class:', options=class_values, index=0)
|
90 |
+
source_option = st.selectbox(label='Origin:', options=source_values, index=0)
|
91 |
special_type_option = st.text_input(label="SpecialSkill Category", value="Hit 3")
|
92 |
special_text_option = st.text_input(label="SpecialSkill Text", value="Dispel")
|
93 |
+
|
94 |
+
st.title('Sorted By')
|
95 |
+
sort_option = st.selectbox(label='Sort by', options=display_cols[1:], index=0)
|
96 |
+
|
97 |
idx_all = []
|
98 |
+
|
99 |
+
if name_option != '':
|
100 |
+
idx_all.append(filter_by_1col(df, 'name', name_option, exact_flag=False))
|
101 |
+
|
102 |
# if star_option is not None:
|
103 |
# idx_all.append(filter_by_1col(df, 'star', star_option, exact_flag=False))
|
104 |
|
|
|
111 |
if class_option != 'None':
|
112 |
idx_all.append(filter_by_1col(df, 'class', class_option, exact_flag=False))
|
113 |
|
114 |
+
if source_option != 'None':
|
115 |
+
idx_all.append(filter_by_1col(df, 'source', source_option, exact_flag=False))
|
116 |
+
|
117 |
+
|
118 |
if special_type_option != '':
|
119 |
idx_all.append(filter_by_1col(df, 'types', special_type_option, exact_flag=False))
|
120 |
|
|
|
125 |
|
126 |
df2 = df[np.all(idx_all,axis=0)]
|
127 |
|
128 |
+
display_heroes_from_df(df2.sort_values(sort_option, ascending=False))
|