Sathwikchowdary commited on
Commit
f415382
·
verified ·
1 Parent(s): 03b9d6c

Update pages/1player_information.py

Browse files
Files changed (1) hide show
  1. pages/1player_information.py +36 -7
pages/1player_information.py CHANGED
@@ -62,19 +62,48 @@ if selected_player:
62
 
63
  col1, col2 = st.columns(2)
64
  with col1:
65
- # Pie Chart - Wickets Taken
66
- wickets = [
67
  0 if pd.isna(player_data.get("bowling_Test_Avg", 0)) else float(player_data.get("bowling_Test_Avg", 0)),
68
- 0 if pd.isna(player_data.get("bowling_ODI_Wickets", 0)) else int(player_data.get("bowling_ODI_Wickets", 0)),
69
- 0 if pd.isna(player_data.get("bowling_T20_Wickets", 0)) else int(player_data.get("bowling_T20_Wickets", 0)),
70
- 0 if pd.isna(player_data.get("bowling_IPL_Wickets", 0)) else int(player_data.get("bowling_IPL_Wickets", 0))
71
  ]
72
  fig, ax = plt.subplots()
73
- ax.pie(wickets, labels=labels, autopct="%1.1f%%", startangle=90)
74
- ax.set_title(f"Wickets Taken by {selected_player}")
75
  st.pyplot(fig)
76
 
77
  with col2:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  # Bar Chart - Maidens Bowled
79
  maidens_bowled = [
80
  player_data.get("bowling_Maidens_Test", 0),
 
62
 
63
  col1, col2 = st.columns(2)
64
  with col1:
65
+ # Pie Chart - Bowling Averages
66
+ bowling_avg = [
67
  0 if pd.isna(player_data.get("bowling_Test_Avg", 0)) else float(player_data.get("bowling_Test_Avg", 0)),
68
+ 0 if pd.isna(player_data.get("bowling_ODI_Avg", 0)) else float(player_data.get("bowling_ODI_Avg", 0)),
69
+ 0 if pd.isna(player_data.get("bowling_T20_Avg", 0)) else float(player_data.get("bowling_T20_Avg", 0)),
70
+ 0 if pd.isna(player_data.get("bowling_IPL_Avg", 0)) else float(player_data.get("bowling_IPL_Avg", 0))
71
  ]
72
  fig, ax = plt.subplots()
73
+ ax.pie(bowling_avg, labels=labels, autopct="%1.1f%%", startangle=90)
74
+ ax.set_title(f"Bowling Averages of {selected_player}")
75
  st.pyplot(fig)
76
 
77
  with col2:
78
+ # Bar Chart - Bowling Innings
79
+ bowling_innings = [
80
+ player_data.get("bowling_Test_Innings", 0),
81
+ player_data.get("bowling_ODI_Innings", 0),
82
+ player_data.get("bowling_T20_Innings", 0),
83
+ player_data.get("bowling_IPL_Innings", 0)
84
+ ]
85
+ fig, ax = plt.subplots()
86
+ ax.bar(labels, bowling_innings, color=["blue", "green", "purple", "orange"])
87
+ ax.set_ylabel("Innings Bowled")
88
+ ax.set_title(f"Bowling Innings of {selected_player}")
89
+ st.pyplot(fig)
90
+
91
+ col3, col4 = st.columns(2)
92
+ with col3:
93
+ # Bar Chart - Balls Bowled
94
+ balls_bowled = [
95
+ player_data.get("bowling_Test_Balls", 0),
96
+ player_data.get("bowling_ODI_Balls", 0),
97
+ player_data.get("bowling_T20_Balls", 0),
98
+ player_data.get("bowling_IPL_Balls", 0)
99
+ ]
100
+ fig, ax = plt.subplots(figsize=(5, 3))
101
+ ax.bar(labels, balls_bowled, color=["red", "yellow", "blue", "green"])
102
+ ax.set_ylabel("Balls Bowled")
103
+ ax.set_title(f"Balls Bowled by {selected_player}")
104
+ st.pyplot(fig)
105
+
106
+ with col4:
107
  # Bar Chart - Maidens Bowled
108
  maidens_bowled = [
109
  player_data.get("bowling_Maidens_Test", 0),