zoya23 commited on
Commit
a2542f1
Β·
verified Β·
1 Parent(s): 4f781ce

Create pages/player_stats

Browse files
Files changed (1) hide show
  1. pages/player_stats +54 -0
pages/player_stats ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Load the dataset
5
+ df = pd.read_csv("cric_final.csv")
6
+
7
+ st.title("🏏 Player Performance Dashboard")
8
+
9
+ # βœ… Dropdown to Select Player
10
+ selected_player = st.selectbox("Select a Player", df["Player"].unique())
11
+
12
+ # Get Player Data
13
+ player_data = df[df["Player"] == selected_player]
14
+
15
+ if not player_data.empty:
16
+ # βœ… Only 2 Tabs now: Batting and Bowling
17
+ tab1, tab2 = st.tabs(["πŸ“‹ Batting Performance", "πŸ“‹ Bowling Performance"])
18
+
19
+ with tab1:
20
+ st.subheader("Batting Performance")
21
+ st.write("**Matches Played**")
22
+ st.write(f"Test: {player_data.iloc[0]['batting_Matches_Test']}")
23
+ st.write(f"ODI: {player_data.iloc[0]['batting_Matches_ODI']}")
24
+ st.write(f"T20: {player_data.iloc[0]['batting_Matches_T20']}")
25
+ st.write(f"IPL: {player_data.iloc[0]['batting_Matches_IPL']}")
26
+
27
+ st.write("**Runs Scored**")
28
+ st.write(f"Test: {player_data.iloc[0]['batting_Runs_Test']}")
29
+ st.write(f"ODI: {player_data.iloc[0]['batting_Runs_ODI']}")
30
+ st.write(f"T20: {player_data.iloc[0]['batting_Runs_T20']}")
31
+ st.write(f"IPL: {player_data.iloc[0]['batting_Runs_IPL']}")
32
+
33
+ st.write("**50s and 100s**")
34
+ st.write(f"50s in Test: {player_data.iloc[0]['batting_50s_Test']}, 100s in Test: {player_data.iloc[0]['batting_100s_Test']}")
35
+ st.write(f"50s in ODI: {player_data.iloc[0]['batting_50s_ODI']}, 100s in ODI: {player_data.iloc[0]['batting_100s_ODI']}")
36
+ st.write(f"50s in T20: {player_data.iloc[0]['batting_50s_T20']}, 100s in T20: {player_data.iloc[0]['batting_100s_T20']}")
37
+ st.write(f"50s in IPL: {player_data.iloc[0]['batting_50s_IPL']}, 100s in IPL: {player_data.iloc[0]['batting_100s_IPL']}")
38
+
39
+ with tab2:
40
+ st.subheader("Bowling Performance")
41
+ st.write("**Matches Played**")
42
+ st.write(f"Test: {player_data.iloc[0]['bowling_Matches_Test']}")
43
+ st.write(f"ODI: {player_data.iloc[0]['bowling_Matches_ODI']}")
44
+ st.write(f"T20: {player_data.iloc[0]['bowling_Matches_T20']}")
45
+ st.write(f"IPL: {player_data.iloc[0]['bowling_Matches_IPL']}")
46
+
47
+ st.write("**Wickets Taken**")
48
+ st.write(f"Test: {player_data.iloc[0]['bowling_Test_Wickets']}")
49
+ st.write(f"ODI: {player_data.iloc[0]['bowling_ODI_Wickets']}")
50
+ st.write(f"T20: {player_data.iloc[0]['bowling_T20_Wickets']}")
51
+ st.write(f"IPL: {player_data.iloc[0]['bowling_IPL_Wickets']}")
52
+
53
+ else:
54
+ st.warning("⚠️ Player not found in the dataset.")