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
`