Skip to content

Commit

Permalink
add question
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Nov 17, 2023
1 parent da72491 commit be381ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def get_tree_coverage_sample(df):
return sample


@st.cache_data
def get_crimes_sample(df):
sample = df.sample(4)
return sample


df = load_df()

with st.expander("Study the dataset"):
Expand Down Expand Up @@ -206,6 +212,21 @@ def get_tree_coverage_sample(df):
):
score += 1

df_crimes = get_crimes_sample(df)
ans_crimes = st.radio(
":blue[Which community has the most crimes?]",
df_crimes["name"],
index=None,
)
ans.append(ans_crimes)
if (
ans_crimes
in df_crimes["name"][
df_crimes["crime_count"] == df_crimes["crime_count"].max()
].tolist()
):
score += 1

total = len(ans)
if score == total:
thumb = ":100:"
Expand Down

0 comments on commit be381ca

Please sign in to comment.