Spaces:
Sleeping
Sleeping
Update pages/1player_information.py
Browse files- pages/1player_information.py +32 -3
pages/1player_information.py
CHANGED
@@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
|
|
6 |
st.set_page_config(page_title="Career Insights", layout="wide")
|
7 |
|
8 |
# Load data
|
9 |
-
df = pd.read_csv("
|
10 |
|
11 |
# Get unique player names
|
12 |
player_names = df["Player"].unique()
|
@@ -30,6 +30,35 @@ if selected_player:
|
|
30 |
col1, col2 = st.columns(2)
|
31 |
|
32 |
with col1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
# Bar Chart - 100s and 50s
|
34 |
hundreds = [
|
35 |
player_data.get("100s_Test", 0),
|
@@ -51,7 +80,7 @@ if selected_player:
|
|
51 |
ax.legend()
|
52 |
st.pyplot(fig)
|
53 |
|
54 |
-
with
|
55 |
# Line Chart - Strike Rate & Average
|
56 |
strike_rate = [
|
57 |
player_data.get("SR_Test", 0),
|
@@ -110,4 +139,4 @@ if selected_player:
|
|
110 |
ax.set_ylabel("Value")
|
111 |
ax.set_title(f"Bowling Average & Strike Rate of {selected_player}")
|
112 |
ax.legend()
|
113 |
-
st.pyplot(fig)
|
|
|
6 |
st.set_page_config(page_title="Career Insights", layout="wide")
|
7 |
|
8 |
# Load data
|
9 |
+
df = pd.read_csv("Teams_Info")
|
10 |
|
11 |
# Get unique player names
|
12 |
player_names = df["Player"].unique()
|
|
|
30 |
col1, col2 = st.columns(2)
|
31 |
|
32 |
with col1:
|
33 |
+
# Pie Chart - Matches Played Across Formats
|
34 |
+
matches = [
|
35 |
+
player_data.get("Matches_Test", 0),
|
36 |
+
player_data.get("Matches_ODI", 0),
|
37 |
+
player_data.get("Matches_T20", 0),
|
38 |
+
player_data.get("Matches_IPL", 0)
|
39 |
+
]
|
40 |
+
fig, ax = plt.subplots()
|
41 |
+
ax.pie(matches, labels=labels, autopct="%1.1f%%", startangle=90)
|
42 |
+
ax.set_title(f"Matches Played by {selected_player}")
|
43 |
+
st.pyplot(fig)
|
44 |
+
|
45 |
+
with col2:
|
46 |
+
# Bar Chart - Runs Scored
|
47 |
+
batting_runs = [
|
48 |
+
player_data.get("batting_Runs_Test", 0),
|
49 |
+
player_data.get("batting_Runs_ODI", 0),
|
50 |
+
player_data.get("batting_Runs_T20", 0),
|
51 |
+
player_data.get("batting_Runs_IPL", 0)
|
52 |
+
]
|
53 |
+
fig, ax = plt.subplots()
|
54 |
+
ax.bar(labels, batting_runs, color=["gold", "green", "blue", "red"])
|
55 |
+
ax.set_ylabel("Runs Scored")
|
56 |
+
ax.set_title(f"Runs Scored by {selected_player}")
|
57 |
+
st.pyplot(fig)
|
58 |
+
|
59 |
+
col3, col4 = st.columns(2)
|
60 |
+
|
61 |
+
with col3:
|
62 |
# Bar Chart - 100s and 50s
|
63 |
hundreds = [
|
64 |
player_data.get("100s_Test", 0),
|
|
|
80 |
ax.legend()
|
81 |
st.pyplot(fig)
|
82 |
|
83 |
+
with col4:
|
84 |
# Line Chart - Strike Rate & Average
|
85 |
strike_rate = [
|
86 |
player_data.get("SR_Test", 0),
|
|
|
139 |
ax.set_ylabel("Value")
|
140 |
ax.set_title(f"Bowling Average & Strike Rate of {selected_player}")
|
141 |
ax.legend()
|
142 |
+
st.pyplot(fig)
|