diff --git a/.DS_Store b/.DS_Store index 3991f7c..9a887ea 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/streamlit_football_demo/.DS_Store b/streamlit_football_demo/.DS_Store index 5ac1c44..da6f27e 100644 Binary files a/streamlit_football_demo/.DS_Store and b/streamlit_football_demo/.DS_Store differ diff --git a/streamlit_football_demo/README.md b/streamlit_football_demo/README.md index f697638..6468010 100644 --- a/streamlit_football_demo/README.md +++ b/streamlit_football_demo/README.md @@ -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: ``` diff --git a/streamlit_football_demo/helloworld.py b/streamlit_football_demo/helloworld.py index 9b8bc89..abf5eba 100644 --- a/streamlit_football_demo/helloworld.py +++ b/streamlit_football_demo/helloworld.py @@ -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')