James McCool commited on
Commit
61d34da
·
1 Parent(s): bae6d41

Refactor app.py to replace MongoDB data retrieval with Google Sheets API calls for the Game_Betting_Model. Commented out legacy MongoDB code and updated data processing to align with the new data source.

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -88,14 +88,19 @@ def init_baselines():
88
  hitter_stats['Hits + Runs + RBIs'] = hitter_stats['Hits'] + hitter_stats['Runs'] + hitter_stats['RBIs']
89
  hitter_stats = hitter_stats.drop_duplicates(subset='Player')
90
 
91
- collection = db['Game_Betting_Model']
92
- cursor = collection.find()
93
- raw_display = pd.DataFrame(cursor)
 
 
 
 
 
 
 
 
 
94
  team_frame = raw_display.drop_duplicates(subset='Names')
95
- team_frame['Win Percentage'] = team_frame['Win Percentage'].str.replace('%', '').astype('float')/100
96
- team_frame['Cover Spread Percentage'] = team_frame['Cover Spread Percentage'].str.replace('%', '').astype('float')/100
97
- team_frame['ML_Value'] = team_frame['ML_Value'].str.replace('%', '').astype('float')/100
98
- team_frame['Spread_Value'] = team_frame['Spread_Value'].str.replace('%', '').astype('float')/100
99
 
100
  sh = gc.open_by_url(master_hold)
101
  worksheet = sh.worksheet('prop_frame')
 
88
  hitter_stats['Hits + Runs + RBIs'] = hitter_stats['Hits'] + hitter_stats['Runs'] + hitter_stats['RBIs']
89
  hitter_stats = hitter_stats.drop_duplicates(subset='Player')
90
 
91
+ # collection = db['Game_Betting_Model']
92
+ # cursor = collection.find()
93
+ # raw_display = pd.DataFrame(cursor)
94
+ # team_frame = raw_display.drop_duplicates(subset='Names')
95
+ # team_frame['Win Percentage'] = team_frame['Win Percentage'].str.replace('%', '').astype('float')/100
96
+ # team_frame['Cover Spread Percentage'] = team_frame['Cover Spread Percentage'].str.replace('%', '').astype('float')/100
97
+ # team_frame['ML_Value'] = team_frame['ML_Value'].str.replace('%', '').astype('float')/100
98
+ # team_frame['Spread_Value'] = team_frame['Spread_Value'].str.replace('%', '').astype('float')/100
99
+
100
+ sh = gc.open_by_url(master_hold)
101
+ worksheet = sh.worksheet('Game_Betting_Model')
102
+ raw_display = pd.DataFrame(worksheet.get_all_records())
103
  team_frame = raw_display.drop_duplicates(subset='Names')
 
 
 
 
104
 
105
  sh = gc.open_by_url(master_hold)
106
  worksheet = sh.worksheet('prop_frame')