Hi there,
I created an app yesterday and it ran fine. This morning have been wanting to make changes to it (different text, position visuals elsewhere on page etc) and I can change it in the .py file but when I run the changes are not reflecting on the webpage. How do I fix this?
I have removed the cache (even though I’m not caching any data etc).
Thank you in advance.
import streamlit as st
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import plotly.express as px
import plotly.graph_objects as go
import datetime as dt
Add Refresh Date
Today_Date = str(dt.datetime.now())
Title App
st.title(“Age vs Utilisation Matrix:”)
League and Season
st.markdown(‘2020/21 DSTV Premiership’)
App description
st.markdown(“This web application is divided into two parts\n.”
‘1) It visualises each teams squad breakdown by age. The higher the curve the more players in that age bracket/range.\n’
“2) The second visual breaks down each player’s playing during the 2020/21 DSTV Premiership season.\n”
‘Overtime minutes are not included.’)
Read data - Age Squad Data
Squad = pd.read_csv(r’C:\Users\Alex\Desktop\DSTV_Prem_Age_Squad_2021.csv’)
Ridgeplot
fig = px.violin(Squad, y=‘Team’, x=‘Age’,
orientation=‘h’).update_traces(side=‘positive’, width=2)
Figure size
fig.update_layout(
width=1000,
height=800
)
Visualise chart
st.plotly_chart(fig)
Sidebar - Team selection
sorted_unique_team = sorted(Squad.Team.unique())
selected_team = st.multiselect(‘Choose a Team’, sorted_unique_team)
Header in main page
st.header(‘Display Playing Time of Selected Team(s)’)
Filtering data
df_select_team = Squad[(Squad.Team.isin(selected_team))]
Show data via a tickbox
if st.checkbox(‘Show Data’):
df_select_team
Scatter plot
fig = px.scatter(df_select_team, x = ‘Age’, y = ‘Percent_Team_Mins_Played’,
text = ‘Last_Name’, color=‘Starting appearances’)
Figure text placement
fig.update_traces(textposition=‘top center’)
Figure size
fig.update_layout(
width=1000,
height=500
)
Visualise chart
st.plotly_chart(fig)
Refresh Date
st.markdown(f"This page was last updated on {Today_Date}")
`Preformatted text
`