Skip to content

Instantly share code, notes, and snippets.

@isauravmanitripathi
Created October 10, 2022 15:42
Show Gist options
  • Save isauravmanitripathi/f8cae51075e38ffec855d7454f322a3e to your computer and use it in GitHub Desktop.
Save isauravmanitripathi/f8cae51075e38ffec855d7454f322a3e to your computer and use it in GitHub Desktop.
# PROCESSING & DISPLAY
def display():
with st.container():
st.write("#### Which cities and states have recorded the most accidents?")
res = computeQuery(query_8, graph)
fig = px.treemap(res, path=[px.Constant("U.S"), "state", "city"], values="count", hover_data=["state", "city","count"],
color="count",
color_continuous_scale='tealrose',
color_continuous_midpoint=np.average(res['count'], weights=res['count']))
st.plotly_chart(fig, use_container_width=True)
with st.expander("Show query"):
st.code(query_8, language="sparql")
st.markdown("---")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment