Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Binary file modified streamlit_football_demo/.DS_Store
Binary file not shown.
5 changes: 5 additions & 0 deletions streamlit_football_demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ While in the past, a well-made visualization or a small PPT used to be enough fo

This code is part of my post [How to write Web apps using simple Python for Data Scientists?](https://towardsdatascience.com/how-to-write-web-apps-using-simple-python-for-data-scientists-a227a1a01582)


Pre Requisite
```
pip install plotly-express
```
To Run app:

```
Expand Down
13 changes: 11 additions & 2 deletions streamlit_football_demo/helloworld.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,23 @@

This very simple webapp allows you to select and visualize players from certain clubs and certain nationalities.
'''


df = st.cache(pd.read_csv)("football_data.csv")

clubs = st.sidebar.multiselect('Show Player for clubs?', df['Club'].unique())
nationalities = st.sidebar.multiselect('Show Player from Nationalities?', df['Nationality'].unique())
"Dataset Preview (fotoball_data.csv)",df

#In the following part the isin function is used however
clubs = st.sidebar.multiselect('Show Player for clubs?', df['Club'].unique()) #give the multiselect dialogue box in the sidebar to select clubs
nationalities = st.sidebar.multiselect('Show Player from Nationalities?', df['Nationality'].unique())#give the multiselect dialogue box in the sidebar to select nationalities

new_df = df[(df['Club'].isin(clubs)) & (df['Nationality'].isin(nationalities))]

"Dataset Preview with the respective filter of clubs and nationalities"
st.write(new_df)



# Create distplot with custom bin_size
fig = px.scatter(new_df, x ='Overall',y='Age',color='Name')

Expand Down