Skip to content
Open
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
5 changes: 4 additions & 1 deletion streamlit/part5/basketball_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def load_data(year):
raw = df.drop(df[df.Age == 'Age'].index) # Deletes repeating headers in content
raw = raw.fillna(0)
playerstats = raw.drop(['Rk'], axis=1)
for i in playerstats.filter(regex='%').columns:
playerstats[i] = playerstats[i].astype(float)
return playerstats
playerstats = load_data(selected_year)

Expand All @@ -43,6 +45,7 @@ def load_data(year):
st.write('Data Dimension: ' + str(df_selected_team.shape[0]) + ' rows and ' + str(df_selected_team.shape[1]) + ' columns.')
st.dataframe(df_selected_team)


# Download NBA player stats data
# https://discuss.streamlit.io/t/how-to-download-file-in-streamlit/1806
def filedownload(df):
Expand All @@ -65,4 +68,4 @@ def filedownload(df):
with sns.axes_style("white"):
f, ax = plt.subplots(figsize=(7, 5))
ax = sns.heatmap(corr, mask=mask, vmax=1, square=True)
st.pyplot()
st.pyplot(f)