Sathwikchowdary commited on
Commit
943bd1e
·
verified ·
1 Parent(s): fd28c1c

Update pages/1player_information.py

Browse files
Files changed (1) hide show
  1. pages/1player_information.py +40 -53
pages/1player_information.py CHANGED
@@ -61,16 +61,16 @@ if selected_player:
61
  with col3:
62
  # Bar Chart - 100s and 50s
63
  hundreds = [
64
- player_data.get("100s_Test", 0),
65
- player_data.get("100s_ODI", 0),
66
- player_data.get("100s_T20", 0),
67
- player_data.get("100s_IPL", 0)
68
  ]
69
  fifties = [
70
- player_data.get("50s_Test", 0),
71
- player_data.get("50s_ODI", 0),
72
- player_data.get("50s_T20", 0),
73
- player_data.get("50s_IPL", 0)
74
  ]
75
  fig, ax = plt.subplots()
76
  ax.bar(labels, hundreds, label="100s", color="gold")
@@ -83,16 +83,16 @@ if selected_player:
83
  with col4:
84
  # Line Chart - Strike Rate & Average
85
  strike_rate = [
86
- player_data.get("SR_Test", 0),
87
- player_data.get("SR_ODI", 0),
88
- player_data.get("SR_T20", 0),
89
- player_data.get("SR_IPL", 0)
90
  ]
91
  batting_avg = [
92
- player_data.get("Avg_Test", 0),
93
- player_data.get("Avg_ODI", 0),
94
- player_data.get("Avg_T20", 0),
95
- player_data.get("Avg_IPL", 0)
96
  ]
97
  fig, ax = plt.subplots()
98
  ax.plot(labels, strike_rate, marker='o', linestyle='-', color='red', label="Strike Rate")
@@ -101,42 +101,29 @@ if selected_player:
101
  ax.set_title(f"Strike Rate & Batting Average of {selected_player}")
102
  ax.legend()
103
  st.pyplot(fig)
104
-
105
- if show_bowling:
106
- col1, col2 = st.columns(2)
107
 
108
- with col1:
109
- # Bar Chart - Economy Rate
110
- economy_rate = [
111
- player_data.get("Econ_Test", 0),
112
- player_data.get("Econ_ODI", 0),
113
- player_data.get("Econ_T20", 0),
114
- player_data.get("Econ_IPL", 0)
115
- ]
116
- fig, ax = plt.subplots()
117
- ax.bar(labels, economy_rate, color=["purple", "orange", "cyan", "brown"])
118
- ax.set_ylabel("Economy Rate")
119
- ax.set_title(f"Economy Rate of {selected_player}")
120
- st.pyplot(fig)
121
 
122
- with col2:
123
- # Scatter Plot - Bowling Average & Strike Rate
124
- bowling_avg = [
125
- player_data.get("Bowl_Avg_Test", 0),
126
- player_data.get("Bowl_Avg_ODI", 0),
127
- player_data.get("Bowl_Avg_T20", 0),
128
- player_data.get("Bowl_Avg_IPL", 0)
129
- ]
130
- bowling_sr = [
131
- player_data.get("Bowl_SR_Test", 0),
132
- player_data.get("Bowl_SR_ODI", 0),
133
- player_data.get("Bowl_SR_T20", 0),
134
- player_data.get("Bowl_SR_IPL", 0)
135
- ]
136
- fig, ax = plt.subplots()
137
- ax.scatter(labels, bowling_avg, color='blue', label="Bowling Average")
138
- ax.scatter(labels, bowling_sr, color='red', label="Bowling Strike Rate")
139
- ax.set_ylabel("Value")
140
- ax.set_title(f"Bowling Average & Strike Rate of {selected_player}")
141
- ax.legend()
142
- st.pyplot(fig)
 
61
  with col3:
62
  # Bar Chart - 100s and 50s
63
  hundreds = [
64
+ player_data.get("batting_100s_Test", 0),
65
+ player_data.get("batting_100s_ODI", 0),
66
+ player_data.get("batting_100s_T20", 0),
67
+ player_data.get("batting_100s_IPL", 0)
68
  ]
69
  fifties = [
70
+ player_data.get("batting_50s_Test", 0),
71
+ player_data.get("batting_50s_ODI", 0),
72
+ player_data.get("batting_50s_T20", 0),
73
+ player_data.get("batting_50s_IPL", 0)
74
  ]
75
  fig, ax = plt.subplots()
76
  ax.bar(labels, hundreds, label="100s", color="gold")
 
83
  with col4:
84
  # Line Chart - Strike Rate & Average
85
  strike_rate = [
86
+ player_data.get("batting_SR_Test", 0),
87
+ player_data.get("batting_SR_ODI", 0),
88
+ player_data.get("batting_SR_T20", 0),
89
+ player_data.get("batting_SR_IPL", 0)
90
  ]
91
  batting_avg = [
92
+ player_data.get("batting_Average_Test", 0),
93
+ player_data.get("batting_Average_ODI", 0),
94
+ player_data.get("batting_Average_T20", 0),
95
+ player_data.get("batting_Average_IPL", 0)
96
  ]
97
  fig, ax = plt.subplots()
98
  ax.plot(labels, strike_rate, marker='o', linestyle='-', color='red', label="Strike Rate")
 
101
  ax.set_title(f"Strike Rate & Batting Average of {selected_player}")
102
  ax.legend()
103
  st.pyplot(fig)
 
 
 
104
 
105
+ # Bar Chart - Batting Innings
106
+ batting_innings = [
107
+ player_data.get("batting_Innings_Test", 0),
108
+ player_data.get("batting_Innings_ODI", 0),
109
+ player_data.get("batting_Innings_T20", 0),
110
+ player_data.get("batting_Innings_IPL", 0)
111
+ ]
112
+ fig, ax = plt.subplots()
113
+ ax.bar(labels, batting_innings, color=["skyblue", "orange", "lime", "purple"])
114
+ ax.set_ylabel("Innings Played")
115
+ ax.set_title(f"Batting Innings by {selected_player}")
116
+ st.pyplot(fig)
 
117
 
118
+ # Bar Chart - Balls Faced
119
+ batting_balls = [
120
+ player_data.get("batting_Balls_Test", 0),
121
+ player_data.get("batting_Balls_ODI", 0),
122
+ player_data.get("batting_Balls_T20", 0),
123
+ player_data.get("batting_Balls_IPL", 0)
124
+ ]
125
+ fig, ax = plt.subplots()
126
+ ax.bar(labels, batting_balls, color=["red", "green", "blue", "purple"])
127
+ ax.set_ylabel("Balls Faced")
128
+ ax.set_title(f"Balls Faced by {selected_player}")
129
+ st.pyplot(fig)