Spaces:
Running
Running
Commit
·
4b6027f
1
Parent(s):
a3faada
Handle double digit week numbers (lol)
Browse files
Source/Predict/predict.py
CHANGED
@@ -126,7 +126,10 @@ def predict(home,away,season,week,total):
|
|
126 |
matrix = xgb.DMatrix(data.astype(float).values)
|
127 |
|
128 |
# create game id
|
129 |
-
|
|
|
|
|
|
|
130 |
|
131 |
try:
|
132 |
moneyline_result = results.loc[results['game_id']==game_id, 'winner'].item()
|
@@ -147,7 +150,7 @@ def predict(home,away,season,week,total):
|
|
147 |
try:
|
148 |
result = results.loc[results['game_id']==game_id, 'total'].item()
|
149 |
over_under_result = 'Over' if float(result)>float(total) else 'Push' if float(result)==float(total) else 'Under'
|
150 |
-
|
151 |
except:
|
152 |
over_under_result = 'N/A'
|
153 |
|
|
|
126 |
matrix = xgb.DMatrix(data.astype(float).values)
|
127 |
|
128 |
# create game id
|
129 |
+
if week < 10:
|
130 |
+
game_id = str(season) + '_0' + str(int(week)) + '_' + away_abbrev + '_' + home_abbrev
|
131 |
+
else:
|
132 |
+
game_id = str(season) + '_' + str(int(week)) + '_' + away_abbrev + '_' + home_abbrev
|
133 |
|
134 |
try:
|
135 |
moneyline_result = results.loc[results['game_id']==game_id, 'winner'].item()
|
|
|
150 |
try:
|
151 |
result = results.loc[results['game_id']==game_id, 'total'].item()
|
152 |
over_under_result = 'Over' if float(result)>float(total) else 'Push' if float(result)==float(total) else 'Under'
|
153 |
+
|
154 |
except:
|
155 |
over_under_result = 'N/A'
|
156 |
|