Skip to content

Instantly share code, notes, and snippets.

@karanjagota
Created April 12, 2021 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karanjagota/45c11a47c5b92df5cb8b190641dc1333 to your computer and use it in GitHub Desktop.
Save karanjagota/45c11a47c5b92df5cb8b190641dc1333 to your computer and use it in GitHub Desktop.
# Display barplot and data on search Input
_input = st.text_input("Enter Year to Search")
if _input:
_df = df[df['year'] == int(_input)]
if len(_df['year'])>0:
_df
if len(_df['year'])>0:
sns.set_theme(style="whitegrid")
fig, ax = plt.subplots()
fig = plt.figure(figsize=(7, 4))
ax = sns.barplot(data=_df, y="Lf-overall", x="year", hue="country", palette="tab20_r")
st.pyplot(fig)
else:
st.write('Data Does Not Exist in the Database')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment