This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import wraps | |
| import time | |
| import logging | |
| import random | |
| logger = logging.getLogger(__name__) | |
| def retry(exceptions, total_tries=4, initial_wait=0.5, backoff_factor=2, logger=None): | |
| """ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import json | |
| import gspread | |
| from oauth2client.service_account import ServiceAccountCredentials | |
| # based on https://www.twilio.com/blog/2017/02/an-easy-way-to-read-and-write-to-a-google-spreadsheet-in-python.html | |
| # read that file for how to generate the creds and how to use gspread to read and write to the spreadsheet | |
| # use creds to create a client to interact with the Google Drive API | |
| scopes = ['https://spreadsheets.google.com/feeds'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_iter(TEAM,home,away,ftr): | |
| df['Draws'] = 'No_Game' | |
| df.loc[((home == TEAM) & (ftr == 'D')) | ((away == TEAM) & (ftr == 'D')), 'Draws'] = 'Draw' | |
| df.loc[((home == TEAM) & (ftr != 'D')) | ((away == TEAM) & (ftr != 'D')), 'Draws'] = 'No_Draw' |