Spaces:
Running
Running
BraydenMoore
commited on
Commit
•
e8d98e1
1
Parent(s):
1146624
Update with 2023 data
Browse files- Source/Data/gbg_and_odds_this_year.csv +1 -1
- Source/Data/gbg_this_year.csv +2 -2
- Source/Data/results.csv +2 -2
- get_record.py +8 -3
Source/Data/gbg_and_odds_this_year.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 13267
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:534898308f03fb7f298241e00406faacb95b8a07322572f907f691dbc7fd2b89
|
3 |
size 13267
|
Source/Data/gbg_this_year.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:73ba311ba24b5c0a0d5514b9ecd560dc3b46eb21b99e0c6dce02700636add533
|
3 |
+
size 22222
|
Source/Data/results.csv
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:493be4d5bb80ee44cdcf7c13c24ff7b462aaaa43cfba1fe933be548ac9668eea
|
3 |
+
size 1739
|
get_record.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
pd.set_option('chained_assignment',None)
|
@@ -28,8 +28,9 @@ predictions_df = pd.DataFrame(predictions).T
|
|
28 |
predictions_df['predicted_winner'] = [i['Winner'][0] if type(i['Winner'])==list else None for i in predictions_df[1]]
|
29 |
predictions_df['predicted_winner'] = predictions_df['predicted_winner'].map(team_abbreviation_to_name)
|
30 |
predictions_df['predicted_over_under'] = [i['Over/Under'][0] if type(i['Over/Under'])==list else None for i in predictions_df[2]]
|
31 |
-
predictions_df = predictions_df.merge(results, left_index=True, right_on='game_id').merge(gbg_and_odds_this_year[['game_id','Total Score Close']]).dropna(subset=['predicted_winner'])
|
32 |
predictions_df['over_under'] = ['Over' if t>tsc else 'Under' if t<tsc else 'Push' for t,tsc in predictions_df[['total','Total Score Close']].values]
|
|
|
33 |
|
34 |
predictions_df['winner_correct'] = (predictions_df['predicted_winner']==predictions_df['winner']).astype(int)
|
35 |
predictions_df['winner_incorrect'] = (predictions_df['predicted_winner']!=predictions_df['winner']).astype(int)
|
@@ -40,11 +41,15 @@ winners_correct = predictions_df['winner_correct'].sum()
|
|
40 |
winners_incorrect = predictions_df['winner_incorrect'].sum()
|
41 |
over_unders_correct = predictions_df['over_under_correct'].sum()
|
42 |
over_unders_incorrect = predictions_df['over_under_incorrect'].sum()
|
|
|
|
|
|
|
43 |
|
44 |
record = {"winners_correct":str(winners_correct),
|
45 |
"winners_incorrect":str(winners_incorrect),
|
46 |
"over_unders_correct":str(over_unders_correct),
|
47 |
-
"over_unders_incorrect":str(over_unders_incorrect)
|
|
|
48 |
|
49 |
import json
|
50 |
with open('Source/Data/record.json', 'w') as f:
|
|
|
1 |
+
from datetime import datetime
|
2 |
import numpy as np
|
3 |
import pandas as pd
|
4 |
pd.set_option('chained_assignment',None)
|
|
|
28 |
predictions_df['predicted_winner'] = [i['Winner'][0] if type(i['Winner'])==list else None for i in predictions_df[1]]
|
29 |
predictions_df['predicted_winner'] = predictions_df['predicted_winner'].map(team_abbreviation_to_name)
|
30 |
predictions_df['predicted_over_under'] = [i['Over/Under'][0] if type(i['Over/Under'])==list else None for i in predictions_df[2]]
|
31 |
+
predictions_df = predictions_df.merge(results, left_index=True, right_on='game_id').merge(gbg_and_odds_this_year[['game_id','Total Score Close','home_team','away_team','game_date']]).dropna(subset=['predicted_winner'])
|
32 |
predictions_df['over_under'] = ['Over' if t>tsc else 'Under' if t<tsc else 'Push' for t,tsc in predictions_df[['total','Total Score Close']].values]
|
33 |
+
predictions_df['game_date'] = pd.to_datetime(predictions_df['game_date'])
|
34 |
|
35 |
predictions_df['winner_correct'] = (predictions_df['predicted_winner']==predictions_df['winner']).astype(int)
|
36 |
predictions_df['winner_incorrect'] = (predictions_df['predicted_winner']!=predictions_df['winner']).astype(int)
|
|
|
41 |
winners_incorrect = predictions_df['winner_incorrect'].sum()
|
42 |
over_unders_correct = predictions_df['over_under_correct'].sum()
|
43 |
over_unders_incorrect = predictions_df['over_under_incorrect'].sum()
|
44 |
+
max_date = predictions_df['game_date'].max()
|
45 |
+
date_obj = datetime.strptime(max_date, "%m/%d/%Y")
|
46 |
+
latest_game = date_obj.strftime("%A, %m/%d")
|
47 |
|
48 |
record = {"winners_correct":str(winners_correct),
|
49 |
"winners_incorrect":str(winners_incorrect),
|
50 |
"over_unders_correct":str(over_unders_correct),
|
51 |
+
"over_unders_incorrect":str(over_unders_incorrect),
|
52 |
+
"latest_game":latest_game}
|
53 |
|
54 |
import json
|
55 |
with open('Source/Data/record.json', 'w') as f:
|