James McCool
commited on
Commit
·
f59a7f1
1
Parent(s):
9b97a5a
ping
Browse files- database_queries.py +1 -44
database_queries.py
CHANGED
|
@@ -2,6 +2,7 @@ import pandas as pd
|
|
| 2 |
import numpy as np
|
| 3 |
import math
|
| 4 |
from database import *
|
|
|
|
| 5 |
|
| 6 |
# Probably should have done this in a dictionary to start with
|
| 7 |
wrong_nfl_team_names = ['Denver Broncos', 'Washington Commanders', 'Cincinnati Bengals', 'Arizona Cardinals', 'Los Angeles Rams', 'Pittsburgh Steelers',
|
|
@@ -13,50 +14,6 @@ right_nfl_name_teams = ['Broncos', 'Commanders', 'Bengals', 'Cardinals', 'Rams',
|
|
| 13 |
'Jets', 'Colts', 'Dolphins', 'Lions', 'Raiders', 'Falcons', 'Seahawks', 'Texans', 'Saints', 'Panthers', 'Giants', 'Browns', 'Titans', 'Eagles', 'Cowboys',
|
| 14 |
'Chiefs', 'Chargers', 'Ravens', 'Bills', 'Vikings', 'Bears']
|
| 15 |
|
| 16 |
-
def define_dk_nfl_showdown_slates():
|
| 17 |
-
collection = nfl_db["DK_SD_NFL_ROO"]
|
| 18 |
-
cursor = collection.find()
|
| 19 |
-
raw_display = pd.DataFrame(list(cursor))
|
| 20 |
-
unique_slates = raw_display['slate'].unique()
|
| 21 |
-
|
| 22 |
-
slate_names = []
|
| 23 |
-
|
| 24 |
-
for slate in unique_slates:
|
| 25 |
-
slate_data = raw_display[raw_display['slate'] == slate]
|
| 26 |
-
slate_name = slate_data.iloc[0]['Team'] + ' vs. ' + slate_data.iloc[0]['Opp']
|
| 27 |
-
slate_names.append(slate_name)
|
| 28 |
-
|
| 29 |
-
slate_name_lookup = dict(zip(slate_names, unique_slates))
|
| 30 |
-
return slate_names, slate_name_lookup
|
| 31 |
-
|
| 32 |
-
def define_fd_nfl_showdown_slates():
|
| 33 |
-
collection = nfl_db["FD_SD_NFL_ROO"]
|
| 34 |
-
cursor = collection.find()
|
| 35 |
-
raw_display = pd.DataFrame(list(cursor))
|
| 36 |
-
unique_slates = raw_display['slate'].unique()
|
| 37 |
-
|
| 38 |
-
slate_names = []
|
| 39 |
-
|
| 40 |
-
for slate in unique_slates:
|
| 41 |
-
slate_data = raw_display[raw_display['slate'] == slate]
|
| 42 |
-
slate_name = slate_data.iloc[0]['Team'] + ' vs. ' + slate_data.iloc[0]['Opp']
|
| 43 |
-
slate_names.append(slate_name)
|
| 44 |
-
|
| 45 |
-
slate_name_lookup = dict(zip(slate_names, unique_slates))
|
| 46 |
-
return slate_names, slate_name_lookup
|
| 47 |
-
|
| 48 |
-
try:
|
| 49 |
-
nfl_slate_names_dk, nfl_slate_name_lookup_dk = define_dk_nfl_showdown_slates()
|
| 50 |
-
except:
|
| 51 |
-
nfl_slate_names_dk = []
|
| 52 |
-
nfl_slate_name_lookup_dk = {}
|
| 53 |
-
|
| 54 |
-
try:
|
| 55 |
-
nfl_slate_names_fd, nfl_slate_name_lookup_fd = define_fd_nfl_showdown_slates()
|
| 56 |
-
except:
|
| 57 |
-
nfl_slate_names_fd = []
|
| 58 |
-
nfl_slate_name_lookup_fd = {}
|
| 59 |
-
|
| 60 |
def init_nfl_baselines(type_var: str, site_var: str, slate_var: str):
|
| 61 |
|
| 62 |
if slate_var == 'Main':
|
|
|
|
| 2 |
import numpy as np
|
| 3 |
import math
|
| 4 |
from database import *
|
| 5 |
+
from datetime import datetime
|
| 6 |
|
| 7 |
# Probably should have done this in a dictionary to start with
|
| 8 |
wrong_nfl_team_names = ['Denver Broncos', 'Washington Commanders', 'Cincinnati Bengals', 'Arizona Cardinals', 'Los Angeles Rams', 'Pittsburgh Steelers',
|
|
|
|
| 14 |
'Jets', 'Colts', 'Dolphins', 'Lions', 'Raiders', 'Falcons', 'Seahawks', 'Texans', 'Saints', 'Panthers', 'Giants', 'Browns', 'Titans', 'Eagles', 'Cowboys',
|
| 15 |
'Chiefs', 'Chargers', 'Ravens', 'Bills', 'Vikings', 'Bears']
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
def init_nfl_baselines(type_var: str, site_var: str, slate_var: str):
|
| 18 |
|
| 19 |
if slate_var == 'Main':
|