Spaces:
Sleeping
Sleeping
Update pages/1player_information.py
Browse files- pages/1player_information.py +21 -1
pages/1player_information.py
CHANGED
@@ -50,7 +50,27 @@ if player_input:
|
|
50 |
ax.set_ylabel("Runs Scored")
|
51 |
ax.set_title("Matches vs Runs in ODIs (All Players)")
|
52 |
st.pyplot(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
else:
|
54 |
st.error("Player not found! Please enter a valid player name.")
|
55 |
|
56 |
-
st.write("Enter a player's name to explore their statistics!")
|
|
|
50 |
ax.set_ylabel("Runs Scored")
|
51 |
ax.set_title("Matches vs Runs in ODIs (All Players)")
|
52 |
st.pyplot(fig)
|
53 |
+
|
54 |
+
# Line Chart - Batting Average Over Formats
|
55 |
+
batting_average = [
|
56 |
+
player_data["batting_Runs_Test"] / max(1, player_data["batting_Innings_Test"]),
|
57 |
+
player_data["batting_Runs_ODI"] / max(1, player_data["batting_Innings_ODI"]),
|
58 |
+
player_data["batting_Runs_T20"] / max(1, player_data["batting_Innings_T20"]),
|
59 |
+
player_data["batting_Runs_IPL"] / max(1, player_data["batting_Innings_IPL"])
|
60 |
+
]
|
61 |
+
fig, ax = plt.subplots()
|
62 |
+
ax.plot(labels, batting_average, marker='o', linestyle='-', color='orange')
|
63 |
+
ax.set_ylabel("Batting Average")
|
64 |
+
ax.set_title(f"Batting Average of {selected_player}")
|
65 |
+
st.pyplot(fig)
|
66 |
+
|
67 |
+
# Histogram - Distribution of Runs Scored by All Players in ODIs
|
68 |
+
fig, ax = plt.subplots()
|
69 |
+
sns.histplot(df["batting_Runs_ODI"], bins=20, kde=True, color='green', ax=ax)
|
70 |
+
ax.set_xlabel("Runs Scored")
|
71 |
+
ax.set_ylabel("Frequency")
|
72 |
+
ax.set_title("Distribution of Runs Scored in ODIs (All Players)")
|
73 |
+
st.pyplot(fig)
|
74 |
else:
|
75 |
st.error("Player not found! Please enter a valid player name.")
|
76 |
|
|