Spaces:
Sleeping
Sleeping
Update pages/player stats.py
Browse files- pages/player stats.py +2 -88
pages/player stats.py
CHANGED
|
@@ -1,89 +1,3 @@
|
|
| 1 |
-
# import streamlit as st
|
| 2 |
-
# import pandas as pd
|
| 3 |
-
# import plotly.express as px
|
| 4 |
-
# import plotly.graph_objects as go
|
| 5 |
-
# from plotly.subplots import make_subplots
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
# # Custom background color using CSS
|
| 9 |
-
# st.markdown("""
|
| 10 |
-
# <style>
|
| 11 |
-
# body {
|
| 12 |
-
# background-color: #e6f2ff;
|
| 13 |
-
# }
|
| 14 |
-
# .stApp {
|
| 15 |
-
# background-color: #e6f2ff;
|
| 16 |
-
# }
|
| 17 |
-
# </style>
|
| 18 |
-
# """, unsafe_allow_html=True)
|
| 19 |
-
|
| 20 |
-
# # Title
|
| 21 |
-
# st.markdown("<h2 style='text-align: center;'>Player Stats Analyzer 📈</h2>", unsafe_allow_html=True)
|
| 22 |
-
# #st.header("Player Stats")
|
| 23 |
-
|
| 24 |
-
# team = st.selectbox(
|
| 25 |
-
# "Select Team",
|
| 26 |
-
# ['India', 'Afghanistan', 'Ireland', 'Pakistan', 'Australia',
|
| 27 |
-
# 'Sri Lanka', 'Bangladesh', 'England', 'West Indies',
|
| 28 |
-
# 'South Africa', 'Zimbabwe', 'New Zealand'],)
|
| 29 |
-
|
| 30 |
-
# skills = st.selectbox("Select Skill Type", ["Batting", "Bowling"])
|
| 31 |
-
|
| 32 |
-
# sheet_name=team+" "+skills
|
| 33 |
-
|
| 34 |
-
# df=pd.read_excel("final_data.xlsx",sheet_name,index_col=None)
|
| 35 |
-
|
| 36 |
-
# player=st.selectbox("Select Player", df["name"].unique())
|
| 37 |
-
|
| 38 |
-
# final_group=df.groupby("name")
|
| 39 |
-
|
| 40 |
-
# #st.write(final_group.get_group(player))
|
| 41 |
-
|
| 42 |
-
# st.header("Player Stats for {} 📊 ".format(player))
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
# final_df=final_group.get_group(player)
|
| 46 |
-
# final_df2=final_df.drop(["name"],axis=1)
|
| 47 |
-
# st.dataframe(final_df2, hide_index=True)
|
| 48 |
-
|
| 49 |
-
# st.header("Dashboards")
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
# for i in range(len(final_df)):
|
| 53 |
-
|
| 54 |
-
# # Get Series of data
|
| 55 |
-
# d1 = final_group.get_group(player).iloc[i][1:-1]
|
| 56 |
-
# #st.dataframe(d1)
|
| 57 |
-
|
| 58 |
-
# df_chart = d1.reset_index()
|
| 59 |
-
# df_chart.columns = ['Skill', 'Value']
|
| 60 |
-
|
| 61 |
-
# # Create subplots: set type='domain' for pie chart position
|
| 62 |
-
# fig = make_subplots(
|
| 63 |
-
# rows=len(final_df)//2, cols=2,
|
| 64 |
-
# specs=[[{'type': 'domain'}, {'type': 'xy'}]], # Pie on left, Bar on right
|
| 65 |
-
# subplot_titles=("Pie Chart", "Bar Chart")
|
| 66 |
-
# )
|
| 67 |
-
|
| 68 |
-
# # Add Pie Chart
|
| 69 |
-
# fig.add_trace(
|
| 70 |
-
# go.Pie(labels=df_chart['Skill'], values=df_chart['Value'], name="Pie"),
|
| 71 |
-
# row=i+1, col=i+1
|
| 72 |
-
# )
|
| 73 |
-
|
| 74 |
-
# # Add Bar Chart
|
| 75 |
-
# fig.add_trace(
|
| 76 |
-
# go.Bar(x=df_chart['Skill'], y=df_chart['Value'], name="Bar"),
|
| 77 |
-
# row=i+1, col=i+2
|
| 78 |
-
# )
|
| 79 |
-
|
| 80 |
-
# # Layout tweaks
|
| 81 |
-
# fig.update_layout(title_text=f"{player}'s {skills} Stats Overview", showlegend=False)
|
| 82 |
-
|
| 83 |
-
# # Display in Streamlit
|
| 84 |
-
# st.plotly_chart(fig, use_container_width=True)
|
| 85 |
-
|
| 86 |
-
|
| 87 |
import streamlit as st
|
| 88 |
import pandas as pd
|
| 89 |
import plotly.express as px
|
|
@@ -187,5 +101,5 @@ st.plotly_chart(fig, use_container_width=True)
|
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
import plotly.express as px
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
+
if st.button("Go to Home Page"):
|
| 105 |
+
st.switch_page("app.py")
|