Spaces:
Running
Running
Commit
·
84ffba8
1
Parent(s):
18423ba
Debug
Browse files
Source/Predict/predict.py
CHANGED
@@ -64,18 +64,18 @@ def get_games(week):
|
|
64 |
def get_one_week(home,away,season,week):
|
65 |
try:
|
66 |
home_df = gbg.loc[((gbg['away_team']==home) | (gbg['home_team']==home)) & (gbg['Season']==season) & (gbg['GP']==week-1)]
|
|
|
67 |
gbg_home_team = home_df['home_team'].item()
|
68 |
home_df.drop(columns=['game_id','home_team','away_team','Season','game_date'], inplace=True)
|
69 |
home_df = home_df[[i for i in home_df.columns if '.Away' not in i] if gbg_home_team==home else [i for i in home_df.columns if '.Away' in i]]
|
70 |
home_df.columns = [i.replace('.Away','') for i in home_df.columns]
|
71 |
-
print(home_df)
|
72 |
|
73 |
away_df = gbg.loc[((gbg['away_team']==away) | (gbg['home_team']==away)) & (gbg['Season']==season) & (gbg['GP']==week-1)]
|
|
|
74 |
gbg_home_team = away_df['home_team'].item()
|
75 |
away_df.drop(columns=['game_id','home_team','away_team','Season','game_date'], inplace=True)
|
76 |
away_df = away_df[[i for i in away_df.columns if '.Away' not in i] if gbg_home_team==away else [i for i in away_df.columns if '.Away' in i]]
|
77 |
away_df.columns = [i.replace('.Away','') + '.Away' for i in away_df.columns]
|
78 |
-
print(away_df)
|
79 |
|
80 |
df = home_df.merge(away_df, left_on='GP', right_on='GP.Away')
|
81 |
print(df.columns)
|
|
|
64 |
def get_one_week(home,away,season,week):
|
65 |
try:
|
66 |
home_df = gbg.loc[((gbg['away_team']==home) | (gbg['home_team']==home)) & (gbg['Season']==season) & (gbg['GP']==week-1)]
|
67 |
+
print(home_df)
|
68 |
gbg_home_team = home_df['home_team'].item()
|
69 |
home_df.drop(columns=['game_id','home_team','away_team','Season','game_date'], inplace=True)
|
70 |
home_df = home_df[[i for i in home_df.columns if '.Away' not in i] if gbg_home_team==home else [i for i in home_df.columns if '.Away' in i]]
|
71 |
home_df.columns = [i.replace('.Away','') for i in home_df.columns]
|
|
|
72 |
|
73 |
away_df = gbg.loc[((gbg['away_team']==away) | (gbg['home_team']==away)) & (gbg['Season']==season) & (gbg['GP']==week-1)]
|
74 |
+
print(away_df)
|
75 |
gbg_home_team = away_df['home_team'].item()
|
76 |
away_df.drop(columns=['game_id','home_team','away_team','Season','game_date'], inplace=True)
|
77 |
away_df = away_df[[i for i in away_df.columns if '.Away' not in i] if gbg_home_team==away else [i for i in away_df.columns if '.Away' in i]]
|
78 |
away_df.columns = [i.replace('.Away','') + '.Away' for i in away_df.columns]
|
|
|
79 |
|
80 |
df = home_df.merge(away_df, left_on='GP', right_on='GP.Away')
|
81 |
print(df.columns)
|