Spaces:
Sleeping
Sleeping
Update pages/1player_information.py
Browse files- pages/1player_information.py +20 -17
pages/1player_information.py
CHANGED
@@ -6,9 +6,12 @@ import matplotlib.pyplot as plt
|
|
6 |
st.set_page_config(page_title="Career Insights", layout="wide")
|
7 |
|
8 |
# Load data
|
9 |
-
file_path = "
|
10 |
df = pd.read_csv(file_path)
|
11 |
|
|
|
|
|
|
|
12 |
# Get unique player names
|
13 |
player_names = df["Player"].unique()
|
14 |
|
@@ -30,10 +33,10 @@ if selected_player:
|
|
30 |
if show_batting:
|
31 |
# Pie Chart - Matches Played Across Formats
|
32 |
matches = [
|
33 |
-
player_data
|
34 |
-
player_data
|
35 |
-
player_data
|
36 |
-
player_data
|
37 |
]
|
38 |
fig, ax = plt.subplots()
|
39 |
ax.pie(matches, labels=labels, autopct="%1.1f%%", startangle=90)
|
@@ -42,10 +45,10 @@ if selected_player:
|
|
42 |
|
43 |
# Bar Chart - Runs Scored
|
44 |
batting_runs = [
|
45 |
-
player_data
|
46 |
-
player_data
|
47 |
-
player_data
|
48 |
-
player_data
|
49 |
]
|
50 |
fig, ax = plt.subplots()
|
51 |
ax.bar(labels, batting_runs, color=["gold", "green", "blue", "red"])
|
@@ -56,10 +59,10 @@ if selected_player:
|
|
56 |
if show_bowling:
|
57 |
# Calculate Overs Bowled
|
58 |
overs_bowled = [
|
59 |
-
player_data
|
60 |
-
player_data
|
61 |
-
player_data
|
62 |
-
player_data
|
63 |
]
|
64 |
|
65 |
# Bar Chart - Overs Bowled
|
@@ -71,10 +74,10 @@ if selected_player:
|
|
71 |
|
72 |
# Line Chart - Wickets Taken
|
73 |
wickets_taken = [
|
74 |
-
player_data
|
75 |
-
player_data
|
76 |
-
player_data
|
77 |
-
player_data
|
78 |
]
|
79 |
fig, ax = plt.subplots()
|
80 |
ax.plot(labels, wickets_taken, marker='o', linestyle='-', color='red')
|
|
|
6 |
st.set_page_config(page_title="Career Insights", layout="wide")
|
7 |
|
8 |
# Load data
|
9 |
+
file_path = "Teams.csv"
|
10 |
df = pd.read_csv(file_path)
|
11 |
|
12 |
+
# Display dataset columns for debugging
|
13 |
+
st.write("Available columns in dataset:", df.columns.tolist())
|
14 |
+
|
15 |
# Get unique player names
|
16 |
player_names = df["Player"].unique()
|
17 |
|
|
|
33 |
if show_batting:
|
34 |
# Pie Chart - Matches Played Across Formats
|
35 |
matches = [
|
36 |
+
player_data.get("Matches_Test", 0),
|
37 |
+
player_data.get("Matches_ODI", 0),
|
38 |
+
player_data.get("Matches_T20", 0),
|
39 |
+
player_data.get("Matches_IPL", 0)
|
40 |
]
|
41 |
fig, ax = plt.subplots()
|
42 |
ax.pie(matches, labels=labels, autopct="%1.1f%%", startangle=90)
|
|
|
45 |
|
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"])
|
|
|
59 |
if show_bowling:
|
60 |
# Calculate Overs Bowled
|
61 |
overs_bowled = [
|
62 |
+
player_data.get("bowling_Test_Balls", 0) // 6,
|
63 |
+
player_data.get("bowling_ODI_Balls", 0) // 6,
|
64 |
+
player_data.get("bowling_T20_Balls", 0) // 6,
|
65 |
+
player_data.get("bowling_IPL_Balls", 0) // 6
|
66 |
]
|
67 |
|
68 |
# Bar Chart - Overs Bowled
|
|
|
74 |
|
75 |
# Line Chart - Wickets Taken
|
76 |
wickets_taken = [
|
77 |
+
player_data.get("bowling_Wickets_Test", 0),
|
78 |
+
player_data.get("bowling_Wickets_ODI", 0),
|
79 |
+
player_data.get("bowling_Wickets_T20", 0),
|
80 |
+
player_data.get("bowling_Wickets_IPL", 0)
|
81 |
]
|
82 |
fig, ax = plt.subplots()
|
83 |
ax.plot(labels, wickets_taken, marker='o', linestyle='-', color='red')
|