Spaces:
Running
Running
Alejandro Cremades
commited on
Commit
•
8ceea03
1
Parent(s):
212e089
Enable users to search in either language
Browse files- Middle_School_Card_List.py +11 -3
Middle_School_Card_List.py
CHANGED
@@ -10,11 +10,19 @@ st.write(
|
|
10 |
)
|
11 |
|
12 |
mslist_df = pd.read_csv(mslist_path)
|
|
|
13 |
st.write(mslist_df.shape[0], "cards are legal")
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
results_df = mslist_df[
|
|
|
|
|
18 |
if name_input:
|
19 |
-
st.write(results_df.shape[0],
|
20 |
st.write(results_df[["name", "name_ja"]])
|
|
|
10 |
)
|
11 |
|
12 |
mslist_df = pd.read_csv(mslist_path)
|
13 |
+
mslist_df.fillna("", inplace=True)
|
14 |
st.write(mslist_df.shape[0], "cards are legal")
|
15 |
|
16 |
+
lang = st.radio("Card language", ("English", "Japanese"))
|
17 |
+
name_input = st.text_input(f"Search by {lang} card name")
|
18 |
+
lang_col = {
|
19 |
+
"English": "name",
|
20 |
+
"Japanese": "name_ja",
|
21 |
+
}
|
22 |
|
23 |
+
results_df = mslist_df[
|
24 |
+
mslist_df[lang_col[lang]].str.contains(name_input.lower(), case=False)
|
25 |
+
]
|
26 |
if name_input:
|
27 |
+
st.write(results_df.shape[0], f'cards found by "{name_input}"')
|
28 |
st.write(results_df[["name", "name_ja"]])
|