Spaces:
Sleeping
Sleeping
Commit
·
eacfaf7
1
Parent(s):
fa7df72
Final
Browse files- S34 Draft Sheet - Captains.csv +10 -0
- app.py +28 -11
S34 Draft Sheet - Captains.csv
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Name:,Dotabuff:,MMR:,Buck's Bucks,Crub Cents,Remaining:
|
2 |
+
Space Cowboy,https://www.dotabuff.com/players/123736773,3487,558,593,593
|
3 |
+
juicy,https://www.dotabuff.com/players/162015739,4269,518,555,555
|
4 |
+
Yop,https://www.dotabuff.com/players/89699373,4751,493,524,524
|
5 |
+
MAPPO,https://www.dotabuff.com/players/123919855,4800,491,521,521
|
6 |
+
ShadowAce,https://www.dotabuff.com/players/167390514,4800,491,521,521
|
7 |
+
Tokc,https://www.dotabuff.com/players/96895570,5016,479,505,505
|
8 |
+
Treebeard,https://www.dotabuff.com/players/95576973,6000,429,418,418
|
9 |
+
DoomCow33,https://www.dotabuff.com/players/172199571,6031,427,415,415
|
10 |
+
TriVal,https://www.dotabuff.com/players/1203364439,6620,397,352,352
|
app.py
CHANGED
@@ -55,17 +55,34 @@ def prepare_single_player_data(user_id, mmr, comf_1, comf_2, comf_3, comf_4, com
|
|
55 |
if key in EXPECTED_COLUMNS:
|
56 |
data[key] = value
|
57 |
|
58 |
-
#
|
59 |
-
|
60 |
-
|
61 |
-
'
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Convert to DataFrame
|
71 |
df = pd.DataFrame([data])
|
|
|
55 |
if key in EXPECTED_COLUMNS:
|
56 |
data[key] = value
|
57 |
|
58 |
+
# Get statistics from league data
|
59 |
+
try:
|
60 |
+
captains_df = pd.read_csv("S34 Draft Sheet Captains.csv")
|
61 |
+
bucks_stats = captains_df["Buck's Bucks"].describe()
|
62 |
+
cents_stats = captains_df["Crub Cents"].describe()
|
63 |
+
|
64 |
+
# Combine stats from both currencies
|
65 |
+
combined_stats = {
|
66 |
+
'count': bucks_stats['count'] + cents_stats['count'],
|
67 |
+
'mean': (bucks_stats['mean'] + cents_stats['mean']) / 2,
|
68 |
+
'std': (bucks_stats['std'] + cents_stats['std']) / 2,
|
69 |
+
'min': min(bucks_stats['min'], cents_stats['min']),
|
70 |
+
'max': max(bucks_stats['max'], cents_stats['max']),
|
71 |
+
'sum': bucks_stats['count'] * bucks_stats['mean'] + cents_stats['count'] * cents_stats['mean']
|
72 |
+
}
|
73 |
+
data.update(combined_stats)
|
74 |
+
except Exception as e:
|
75 |
+
print(f"Error reading captains data: {e}")
|
76 |
+
# Fallback to mock data if file read fails
|
77 |
+
stats = {
|
78 |
+
'count': 1,
|
79 |
+
'mean': mmr / 200,
|
80 |
+
'std': mmr / 400,
|
81 |
+
'min': mmr / 250,
|
82 |
+
'max': mmr / 150,
|
83 |
+
'sum': mmr / 200
|
84 |
+
}
|
85 |
+
data.update(stats)
|
86 |
|
87 |
# Convert to DataFrame
|
88 |
df = pd.DataFrame([data])
|