def main():
    teams = []
    args = arguments()
    predictor = Predictor(args.dataset)
    for team in Teams():
        teams.append(Team(team.name, team.abbreviation))
    parse_boxscores(predictor, teams, args.skip_save_to_mongodb)
Exemple #2
0
def make_graph():
    sg = SeasonGraph()

    ranker_log.info("Collecting teams...")
    sr_teams = Teams(year=2019)
    num_teams = len(sr_teams)
    for t in sr_teams:
        ranker_log.debug('{}'.format(t.abbreviation.upper()))
        sg.teams[t.abbreviation.upper()] = TeamNode(t.abbreviation.upper(),
                                                    score=1.0 / num_teams)

    ranker_log.info("Collecting games...")
    for t in sr_teams:
        ranker_log.debug('{}'.format(t.abbreviation.upper()))
        for g in t.schedule:
            ranker_log.debug('{}'.format(g.opponent_abbr.upper()))
            if g.opponent_abbr.upper() not in sg.teams.keys():
                ranker_log.warning("Skipping game: '{}' not in graph".format(
                    g.opponent_abbr.upper()))
            elif g.datetime.date() >= datetime.now().date():
                ranker_log.warning("Skipping game: Has not been played yet")
            elif skip_postseason and g.type != 'Reg':
                ranker_log.warning("Skipping game: Not in the regular season")
            elif g.points_for < g.points_against:
                ranker_log.warning("Skipping game: Win")
            else:
                sg.teams[t.abbreviation.upper()].edges[g.opponent_abbr.upper()] = \
                    GameEdge(g.points_for, g.points_against, g.location, g.datetime)

    return sg
def main():
    args = arguments()
    check_dir(args.match_data_location)
    check_dir(args.team_stats_location)
    teams = Teams()
    for team in teams:
        df = team.dataframe
        defensive_rebound_percentage = 100.0 * df['defensive_rebounds'] /\
            (df['defensive_rebounds'] + df['opp_offensive_rebounds'])
        df['defensive_rebound_percentage'] = defensive_rebound_percentage
        df.to_pickle('%s/%s.plk' % (args.team_stats_location,
                                    team.abbreviation.lower()))
        if args.skip_pulling_matches:
            continue
        for game in team.schedule:
            path = '%s/%s/%s.plk' % (args.match_data_location,
                                     team.abbreviation.lower(),
                                     game.boxscore_index)
            if check_path(path, team.abbreviation.lower(),
                          args.match_data_location) or \
               not game.boxscore_index:
                continue
            # Occurs when the opponent is Non-DI and the game should be skipped
            # since only DI matchups should be analyzed.
            if game.opponent_abbr == game.opponent_name:
                continue
            opponent = teams(game.opponent_abbr)
            opponent.strength_of_schedule, opponent.simple_rating_system
            df = add_sos_and_srs(game, teams, team)
            try:
                df.to_pickle(path)
            except AttributeError:
                continue
Exemple #4
0
def find_teams():
    a = str(input("Enter worse seed team: "))
    b = str(input("Enter better seed team: "))

    for team in Teams():
        if team.abbreviation == a:
            team_one = team
        if team.abbreviation == b:
            team_two = team

    return team_one, team_two
Exemple #5
0
    def get_season_data(years):
        # Get historical season data
        df = pd.DataFrame()
        for year in years:
            for team in Teams(year):
                try:
                    df = pd.concat([df, team.dataframe.assign(Year=year)])
                except:
                    print(team.name, year, "Not in Available")

        return df
Exemple #6
0
def seed_database():
    print("Adding seed data to the database.")
    teams = list(Teams(2019))
    teams.sort(key=lambda x: x.name)
    for team in teams:
        new_team = Team(id=team.abbreviation, name=team.name)
        db.session.add(new_team)
    try:
        db.session.commit()
    except:
        db.session.rollback()
def teams_list(conference, with_names=False):
    teams = []
    names = {}
    if not conference:
        for team in Teams():
            teams.append({team.abbreviation: team})
            names[team.abbreviation] = team.name
    else:
        for abbreviation, name in conference['teams'].items():
            teams.append(abbreviation)
            names[abbreviation] = name
    if with_names:
        return teams, names
    return teams
def get_team_id():
    """
    Creates CSV file of every teams' unique id
    
    example : 
        
        st. John's University - ST-JOHNS-NY
    """
    team_abb = []
    for team in Teams():
        team_abb.append(team.abbreviation)

    with open('Data/team_abb.csv', 'w', newline='') as result_file:
        wr = csv.writer(result_file, quoting=csv.QUOTE_ALL)
        wr.writerow(team_abb)
def main():
    min_date = date(2021, 11, 9)
    max_date = date(2022, 3, 14)

    print("Fetching Games")
    boxs = Boxscores(min_date, max_date)

    print("Writing Games")
    with open('../../data/gamelist_20220314.pkl', 'wb') as fh:
        pickle.dump(boxs.games, fh)

    print("Fetching Teams")
    teams = Teams()

    print("Writing Teams")
    with open('../../data/teamlist_20220314.pkl', 'wb') as fh:
        pickle.dump(teams, fh)
Exemple #10
0
async def on_ready():
    def timegrabber():
        currenttime = time.time_ns()
        return currenttime

    while True:

        channel = client.get_channel(data.channel)

        teamnames = []
        teamwins = []
        newarray = []

        #gathers all team names
        for team in Teams():
            teamnames.append(team.name)

        def datagather():
            for team in Teams():
                teamwins.append(team.wins)
            return teamwins

        oldarray = datagather()
        now = timegrabber()
        toggle = 0
        while toggle == 0:
            later = timegrabber()
            if later - now > 900000000000:
                print(datetime.datetime.now().strftime('%b-%d-%I%M%p-%G'))
                newarray = datagather()
                toggle = 1

        list_difference = []
        for item in oldarray:
            if item not in newarray:
                list_difference.append(item)

        if len(list_difference) > 0:
            location = oldarray.index(
                list_difference[0])  #gets position of what is different
            message = "@everyone " + teamnames[location] + " wins!"
            await channel.send(message)
Exemple #11
0
def gamesOnDate(date):
    games = []
    date = dateTransform(date)
    all_teams = Teams()
    for team in all_teams:
        teamSchedule = team.schedule
        for game in teamSchedule:
            if game.date == date:
                newGame = Game("team1", "team2", "none")
                if game.location == "Home" or game.location == "Neutral":
                    newGame.home = team.name
                    newGame.away = game.opponent_name
                    newGame.loc = game.location
                else:
                    newGame.away = team.name
                    newGame.home = game.opponent_name
                    newGame.loc = game.location
                if newGame.repeat(games):
                    break
                games.append(newGame)
    return games
Exemple #12
0
 def build_data_sheet(self):
     self.teams = Teams(2020).dataframes['abbreviation']
     self._pull_team_stats()
     self.df.to_excel('../data/model_data_v2.xlsx')
Exemple #13
0
from pymongo import MongoClient
from sportsreference.ncaab.teams import Teams
from time import strftime

client = MongoClient()
db = client.clarktechsports

sos = {}
srs = {}

for team in Teams():
    # Convert the pandas DataFrame to a single-dimension index-less dictionary
    team_stats = team.dataframe.to_dict('r')[0]
    sos[team.abbreviation] = team.strength_of_schedule
    srs[team.abbreviation] = team.simple_rating_system
    # Determine if a document already exists for the given team
    if bool(db.teams.find({"abbreviation": team.abbreviation}).count()):
        # If a document exists, overwrite all stats with the latest values
        db.teams.update_one({"abbreviation": team.abbreviation},
                            {"$set": team_stats})
    else:
        # If a document doesn't exist, add a new one
        db.teams.insert_one(team_stats)

# Insert every team's strength of schedule, indexed by the date
db.sos.insert_one({"date": strftime("%x"), "sos": sos})
# Insert every team's simple rating system score, indexed by the date
db.srs.insert_one({"date": strftime("%x"), "srs": srs})
Exemple #14
0
def main():
    args = arguments()
    teams = Teams()
    rankings = Rankings().current
    predictor = Predictor()
    initiate_algorithm(args, predictor, teams, rankings)
Exemple #15
0
    return team.reset_index()


def create_matchup_data(home, away):
    home_stats = replace_feature_names(home)
    away_stats = replace_feature_names(away, away=True)
    return pd.concat([away_stats, home_stats], axis=1)


def parse_arguments():
    parser = ArgumentParser()
    parser.add_argument('home',
                        help='Specify the name of the home team as '
                        'noted on sports-reference.com, such as "purdue".')
    parser.add_argument('away',
                        help='Specify the name of the away team as '
                        'noted on sports-reference.com, such as "indiana".')
    return parser.parse_args()


args = parse_arguments()
teams = Teams()
dataset = create_dataset(teams)
X_train, X_test, y_train, y_test = process_data(dataset)
model = build_model(X_train, y_train)
match_stats = create_matchup_data(
    teams(args.home).dataframe,
    teams(args.away).dataframe)
df = match_stats.loc[:, X_train.columns]
result = model.predict(df).astype(int)
print('%s %s - %s %s' % (args.home, result[0][0], result[0][1], args.away))
Exemple #16
0
 def datagather():
     for team in Teams():
         teamwins.append(team.wins)
     return teamwins
Exemple #17
0
def get_team_data():
    allTeams = {}
    teams = Teams(2019)
    for team in teams:
        allTeams[team.name] = team
    return allTeams
    def setup_method(self, *args, **kwargs):
        self.results = {
            'conference': 'big-ten',
            'abbreviation': 'PURDUE',
            'name': 'Purdue',
            'games_played': 37,
            'wins': 30,
            'losses': 7,
            'win_percentage': .811,
            'simple_rating_system': 23.41,
            'strength_of_schedule': 8.74,
            'conference_wins': 15,
            'conference_losses': 3,
            'home_wins': 16,
            'home_losses': 1,
            'away_wins': 8,
            'away_losses': 2,
            'points': 2974,
            'opp_points': 2431,
            'minutes_played': 1485,
            'field_goals': 1033,
            'field_goal_attempts': 2097,
            'field_goal_percentage': .493,
            'three_point_field_goals': 353,
            'three_point_field_goal_attempts': 840,
            'three_point_field_goal_percentage': .420,
            'two_point_field_goals': 680,
            'two_point_field_goal_attempts': 1257,
            'two_point_field_goal_percentage': .541,
            'free_throws': 555,
            'free_throw_attempts': 747,
            'free_throw_percentage': .743,
            'offensive_rebounds': 311,
            'defensive_rebounds': 984,
            'total_rebounds': 1295,
            'assists': 598,
            'steals': 211,
            'blocks': 180,
            'turnovers': 399,
            'personal_fouls': 580,
            'opp_field_goals': 907,
            'opp_field_goal_attempts': 2197,
            'opp_field_goal_percentage': .413,
            'opp_three_point_field_goals': 251,
            'opp_three_point_field_goal_attempts': 755,
            'opp_three_point_field_goal_percentage': .332,
            'opp_two_point_field_goals': 656,
            'opp_two_point_field_goal_attempts': 1442,
            'opp_two_point_field_goal_percentage': .455,
            'opp_free_throws': 366,
            'opp_free_throw_attempts': 531,
            'opp_free_throw_percentage': .689,
            'opp_offensive_rebounds': 376,
            'opp_defensive_rebounds': 828,
            'opp_total_rebounds': 1204,
            'opp_assists': 443,
            'opp_steals': 190,
            'opp_blocks': 94,
            'opp_turnovers': 448,
            'opp_personal_fouls': 688,
            'pace': 68.2,
            'offensive_rating': 117.5,
            'net_rating': 21.5,
            'free_throw_attempt_rate': .356,
            'three_point_attempt_rate': .401,
            'true_shooting_percentage': .606,
            'total_rebound_percentage': 51.8,
            'assist_percentage': 57.9,
            'steal_percentage': 8.3,
            'block_percentage': 12.5,
            'effective_field_goal_percentage': .577,
            'turnover_percentage': 14.0,
            'offensive_rebound_percentage': 27.3,
            'free_throws_per_field_goal_attempt': .265,
            'opp_offensive_rating': 96.0,
            'opp_free_throw_attempt_rate': .242,
            'opp_three_point_attempt_rate': .344,
            'opp_true_shooting_percentage': .496,
            'opp_total_rebound_percentage': 48.2,
            'opp_assist_percentage': 48.8,
            'opp_steal_percentage': 7.5,
            'opp_block_percentage': 7.5,
            'opp_effective_field_goal_percentage': .470,
            'opp_turnover_percentage': 15.5,
            'opp_offensive_rebound_percentage': 27.6,
            'opp_free_throws_per_field_goal_attempt': .167
        }
        self.abbreviations = [
            'ABILENE-CHRISTIAN', 'AIR-FORCE', 'AKRON', 'ALABAMA-AM',
            'ALABAMA-BIRMINGHAM', 'ALABAMA-STATE', 'ALABAMA', 'ALBANY-NY',
            'ALCORN-STATE', 'AMERICAN', 'APPALACHIAN-STATE', 'ARIZONA-STATE',
            'ARIZONA', 'ARKANSAS-LITTLE-ROCK', 'ARKANSAS-PINE-BLUFF',
            'ARKANSAS-STATE', 'ARKANSAS', 'ARMY', 'AUBURN', 'AUSTIN-PEAY',
            'BALL-STATE', 'BAYLOR', 'BELMONT', 'BETHUNE-COOKMAN', 'BINGHAMTON',
            'BOISE-STATE', 'BOSTON-COLLEGE', 'BOSTON-UNIVERSITY',
            'BOWLING-GREEN-STATE', 'BRADLEY', 'BRIGHAM-YOUNG', 'BROWN',
            'BRYANT', 'BUCKNELL', 'BUFFALO', 'BUTLER', 'CAL-POLY',
            'CAL-STATE-BAKERSFIELD', 'CAL-STATE-FULLERTON',
            'CAL-STATE-NORTHRIDGE', 'CALIFORNIA-DAVIS', 'CALIFORNIA-IRVINE',
            'CALIFORNIA-RIVERSIDE', 'CALIFORNIA-SANTA-BARBARA', 'CALIFORNIA',
            'CAMPBELL', 'CANISIUS', 'CENTRAL-ARKANSAS',
            'CENTRAL-CONNECTICUT-STATE', 'CENTRAL-FLORIDA', 'CENTRAL-MICHIGAN',
            'CHARLESTON-SOUTHERN', 'CHARLOTTE', 'CHATTANOOGA', 'CHICAGO-STATE',
            'CINCINNATI', 'CITADEL', 'CLEMSON', 'CLEVELAND-STATE',
            'COASTAL-CAROLINA', 'COLGATE', 'COLLEGE-OF-CHARLESTON',
            'COLORADO-STATE', 'COLORADO', 'COLUMBIA', 'CONNECTICUT',
            'COPPIN-STATE', 'CORNELL', 'CREIGHTON', 'DARTMOUTH', 'DAVIDSON',
            'DAYTON', 'DELAWARE-STATE', 'DELAWARE', 'DENVER', 'DEPAUL',
            'DETROIT-MERCY', 'DRAKE', 'DREXEL', 'DUKE', 'DUQUESNE',
            'EAST-CAROLINA', 'EAST-TENNESSEE-STATE', 'EASTERN-ILLINOIS',
            'EASTERN-KENTUCKY', 'EASTERN-MICHIGAN', 'EASTERN-WASHINGTON',
            'ELON', 'EVANSVILLE', 'FAIRFIELD', 'FAIRLEIGH-DICKINSON',
            'FLORIDA-AM', 'FLORIDA-ATLANTIC', 'FLORIDA-GULF-COAST',
            'FLORIDA-INTERNATIONAL', 'FLORIDA-STATE', 'FLORIDA', 'FORDHAM',
            'FRESNO-STATE', 'FURMAN', 'GARDNER-WEBB', 'GEORGE-MASON',
            'GEORGE-WASHINGTON', 'GEORGETOWN', 'GEORGIA-SOUTHERN',
            'GEORGIA-STATE', 'GEORGIA-TECH', 'GEORGIA', 'GONZAGA', 'GRAMBLING',
            'GRAND-CANYON', 'GREEN-BAY', 'HAMPTON', 'HARTFORD', 'HARVARD',
            'HAWAII', 'HIGH-POINT', 'HOFSTRA', 'HOLY-CROSS', 'HOUSTON-BAPTIST',
            'HOUSTON', 'HOWARD', 'IDAHO-STATE', 'IDAHO', 'ILLINOIS-CHICAGO',
            'ILLINOIS-STATE', 'ILLINOIS', 'INCARNATE-WORD', 'INDIANA-STATE',
            'INDIANA', 'IONA', 'IOWA-STATE', 'IOWA', 'IPFW', 'IUPUI',
            'JACKSON-STATE', 'JACKSONVILLE-STATE', 'JACKSONVILLE',
            'JAMES-MADISON', 'KANSAS-STATE', 'KANSAS', 'KENNESAW-STATE',
            'KENT-STATE', 'KENTUCKY', 'LA-SALLE', 'LAFAYETTE', 'LAMAR',
            'LEHIGH', 'LIBERTY', 'LIPSCOMB', 'LONG-BEACH-STATE',
            'LONG-ISLAND-UNIVERSITY', 'LONGWOOD', 'LOUISIANA-LAFAYETTE',
            'LOUISIANA-MONROE', 'LOUISIANA-STATE', 'LOUISIANA-TECH',
            'LOUISVILLE', 'LOYOLA-IL', 'LOYOLA-MARYMOUNT', 'LOYOLA-MD',
            'MAINE', 'MANHATTAN', 'MARIST', 'MARQUETTE', 'MARSHALL',
            'MARYLAND-BALTIMORE-COUNTY', 'MARYLAND-EASTERN-SHORE', 'MARYLAND',
            'MASSACHUSETTS-LOWELL', 'MASSACHUSETTS', 'MCNEESE-STATE',
            'MEMPHIS', 'MERCER', 'MIAMI-FL', 'MIAMI-OH', 'MICHIGAN-STATE',
            'MICHIGAN', 'MIDDLE-TENNESSEE', 'MILWAUKEE', 'MINNESOTA',
            'MISSISSIPPI-STATE', 'MISSISSIPPI-VALLEY-STATE', 'MISSISSIPPI',
            'MISSOURI-KANSAS-CITY', 'MISSOURI-STATE', 'MISSOURI', 'MONMOUTH',
            'MONTANA-STATE', 'MONTANA', 'MOREHEAD-STATE', 'MORGAN-STATE',
            'MOUNT-ST-MARYS', 'MURRAY-STATE', 'NAVY', 'NEBRASKA-OMAHA',
            'NEBRASKA', 'NEVADA-LAS-VEGAS', 'NEVADA', 'NEW-HAMPSHIRE',
            'NEW-MEXICO-STATE', 'NEW-MEXICO', 'NEW-ORLEANS', 'NIAGARA',
            'NICHOLLS-STATE', 'NJIT', 'NORFOLK-STATE',
            'NORTH-CAROLINA-ASHEVILLE', 'NORTH-CAROLINA-AT',
            'NORTH-CAROLINA-CENTRAL', 'NORTH-CAROLINA-GREENSBORO',
            'NORTH-CAROLINA-STATE', 'NORTH-CAROLINA-WILMINGTON',
            'NORTH-CAROLINA', 'NORTH-DAKOTA-STATE', 'NORTH-DAKOTA',
            'NORTH-FLORIDA', 'NORTH-TEXAS', 'NORTHEASTERN', 'NORTHERN-ARIZONA',
            'NORTHERN-COLORADO', 'NORTHERN-ILLINOIS', 'NORTHERN-IOWA',
            'NORTHERN-KENTUCKY', 'NORTHWESTERN-STATE', 'NORTHWESTERN',
            'NOTRE-DAME', 'OAKLAND', 'OHIO-STATE', 'OHIO', 'OKLAHOMA-STATE',
            'OKLAHOMA', 'OLD-DOMINION', 'ORAL-ROBERTS', 'OREGON-STATE',
            'OREGON', 'PACIFIC', 'PENN-STATE', 'PENNSYLVANIA', 'PEPPERDINE',
            'PITTSBURGH', 'PORTLAND-STATE', 'PORTLAND', 'PRAIRIE-VIEW',
            'PRESBYTERIAN', 'PRINCETON', 'PROVIDENCE', 'PURDUE', 'QUINNIPIAC',
            'RADFORD', 'RHODE-ISLAND', 'RICE', 'RICHMOND', 'RIDER',
            'ROBERT-MORRIS', 'RUTGERS', 'SACRAMENTO-STATE', 'SACRED-HEART',
            'SAINT-FRANCIS-PA', 'SAINT-JOSEPHS', 'SAINT-LOUIS',
            'SAINT-MARYS-CA', 'SAINT-PETERS', 'SAM-HOUSTON-STATE', 'SAMFORD',
            'SAN-DIEGO-STATE', 'SAN-DIEGO', 'SAN-FRANCISCO', 'SAN-JOSE-STATE',
            'SANTA-CLARA', 'SAVANNAH-STATE', 'SEATTLE', 'SETON-HALL', 'SIENA',
            'SOUTH-ALABAMA', 'SOUTH-CAROLINA-STATE', 'SOUTH-CAROLINA-UPSTATE',
            'SOUTH-CAROLINA', 'SOUTH-DAKOTA-STATE', 'SOUTH-DAKOTA',
            'SOUTH-FLORIDA', 'SOUTHEAST-MISSOURI-STATE',
            'SOUTHEASTERN-LOUISIANA', 'SOUTHERN-CALIFORNIA',
            'SOUTHERN-ILLINOIS-EDWARDSVILLE', 'SOUTHERN-ILLINOIS',
            'SOUTHERN-METHODIST', 'SOUTHERN-MISSISSIPPI', 'SOUTHERN-UTAH',
            'SOUTHERN', 'ST-BONAVENTURE', 'ST-FRANCIS-NY', 'ST-JOHNS-NY',
            'STANFORD', 'STEPHEN-F-AUSTIN', 'STETSON', 'STONY-BROOK',
            'SYRACUSE', 'TEMPLE', 'TENNESSEE-MARTIN', 'TENNESSEE-STATE',
            'TENNESSEE-TECH', 'TENNESSEE', 'TEXAS-AM-CORPUS-CHRISTI',
            'TEXAS-AM', 'TEXAS-ARLINGTON', 'TEXAS-CHRISTIAN', 'TEXAS-EL-PASO',
            'TEXAS-PAN-AMERICAN', 'TEXAS-SAN-ANTONIO', 'TEXAS-SOUTHERN',
            'TEXAS-STATE', 'TEXAS-TECH', 'TEXAS', 'TOLEDO', 'TOWSON', 'TROY',
            'TULANE', 'TULSA', 'UCLA', 'UTAH-STATE', 'UTAH-VALLEY', 'UTAH',
            'VALPARAISO', 'VANDERBILT', 'VERMONT', 'VILLANOVA',
            'VIRGINIA-COMMONWEALTH', 'VIRGINIA-MILITARY-INSTITUTE',
            'VIRGINIA-TECH', 'VIRGINIA', 'WAGNER', 'WAKE-FOREST',
            'WASHINGTON-STATE', 'WASHINGTON', 'WEBER-STATE', 'WEST-VIRGINIA',
            'WESTERN-CAROLINA', 'WESTERN-ILLINOIS', 'WESTERN-KENTUCKY',
            'WESTERN-MICHIGAN', 'WICHITA-STATE', 'WILLIAM-MARY', 'WINTHROP',
            'WISCONSIN', 'WOFFORD', 'WRIGHT-STATE', 'WYOMING', 'XAVIER',
            'YALE', 'YOUNGSTOWN-STATE'
        ]

        team_conference = {
            'kansas': 'big-12',
            'texas-tech': 'big-12',
            'west-virginia': 'big-12',
            'kansas-state': 'big-12',
            'texas-christian': 'big-12',
            'oklahoma-state': 'big-12',
            'oklahoma': 'big-12',
            'baylor': 'big-12',
            'texas': 'big-12',
            'iowa-state': 'big-12',
            'xavier': 'big-east',
            'villanova': 'big-east',
            'seton-hall': 'big-east',
            'creighton': 'big-east',
            'providence': 'big-east',
            'butler': 'big-east',
            'marquette': 'big-east',
            'georgetown': 'big-east',
            'st-johns-ny': 'big-east',
            'depaul': 'big-east',
            'virginia': 'acc',
            'duke': 'acc',
            'clemson': 'acc',
            'north-carolina': 'acc',
            'miami-fl': 'acc',
            'north-carolina-state': 'acc',
            'virginia-tech': 'acc',
            'florida-state': 'acc',
            'louisville': 'acc',
            'syracuse': 'acc',
            'notre-dame': 'acc',
            'boston-college': 'acc',
            'georgia-tech': 'acc',
            'wake-forest': 'acc',
            'pittsburgh': 'acc',
            'michigan-state': 'big-ten',
            'purdue': 'big-ten',
            'ohio-state': 'big-ten',
            'michigan': 'big-ten',
            'nebraska': 'big-ten',
            'penn-state': 'big-ten',
            'indiana': 'big-ten',
            'maryland': 'big-ten',
            'wisconsin': 'big-ten',
            'northwestern': 'big-ten',
            'minnesota': 'big-ten',
            'illinois': 'big-ten',
            'iowa': 'big-ten',
            'rutgers': 'big-ten',
            'auburn': 'sec',
            'tennessee': 'sec',
            'florida': 'sec',
            'kentucky': 'sec',
            'arkansas': 'sec',
            'missouri': 'sec',
            'mississippi-state': 'sec',
            'texas-am': 'sec',
            'alabama': 'sec',
            'louisiana-state': 'sec',
            'georgia': 'sec',
            'south-carolina': 'sec',
            'vanderbilt': 'sec',
            'mississippi': 'sec',
            'arizona': 'pac-12',
            'southern-california': 'pac-12',
            'utah': 'pac-12',
            'ucla': 'pac-12',
            'stanford': 'pac-12',
            'oregon': 'pac-12',
            'washington': 'pac-12',
            'arizona-state': 'pac-12',
            'colorado': 'pac-12',
            'oregon-state': 'pac-12',
            'washington-state': 'pac-12',
            'california': 'pac-12',
            'cincinnati': 'aac',
            'houston': 'aac',
            'wichita-state': 'aac',
            'tulsa': 'aac',
            'memphis': 'aac',
            'central-florida': 'aac',
            'temple': 'aac',
            'connecticut': 'aac',
            'southern-methodist': 'aac',
            'tulane': 'aac',
            'east-carolina': 'aac',
            'south-florida': 'aac',
            'nevada': 'mwc',
            'boise-state': 'mwc',
            'new-mexico': 'mwc',
            'san-diego-state': 'mwc',
            'fresno-state': 'mwc',
            'wyoming': 'mwc',
            'nevada-las-vegas': 'mwc',
            'utah-state': 'mwc',
            'air-force': 'mwc',
            'colorado-state': 'mwc',
            'san-jose-state': 'mwc',
            'loyola-il': 'mvc',
            'southern-illinois': 'mvc',
            'illinois-state': 'mvc',
            'drake': 'mvc',
            'bradley': 'mvc',
            'indiana-state': 'mvc',
            'missouri-state': 'mvc',
            'evansville': 'mvc',
            'northern-iowa': 'mvc',
            'valparaiso': 'mvc',
            'rhode-island': 'atlantic-10',
            'st-bonaventure': 'atlantic-10',
            'davidson': 'atlantic-10',
            'saint-josephs': 'atlantic-10',
            'virginia-commonwealth': 'atlantic-10',
            'saint-louis': 'atlantic-10',
            'george-mason': 'atlantic-10',
            'richmond': 'atlantic-10',
            'dayton': 'atlantic-10',
            'duquesne': 'atlantic-10',
            'george-washington': 'atlantic-10',
            'la-salle': 'atlantic-10',
            'massachusetts': 'atlantic-10',
            'fordham': 'atlantic-10',
            'gonzaga': 'wcc',
            'saint-marys-ca': 'wcc',
            'brigham-young': 'wcc',
            'san-diego': 'wcc',
            'san-francisco': 'wcc',
            'pacific': 'wcc',
            'santa-clara': 'wcc',
            'loyola-marymount': 'wcc',
            'portland': 'wcc',
            'pepperdine': 'wcc',
            'middle-tennessee': 'cusa',
            'old-dominion': 'cusa',
            'western-kentucky': 'cusa',
            'marshall': 'cusa',
            'texas-san-antonio': 'cusa',
            'alabama-birmingham': 'cusa',
            'north-texas': 'cusa',
            'florida-international': 'cusa',
            'louisiana-tech': 'cusa',
            'southern-mississippi': 'cusa',
            'florida-atlantic': 'cusa',
            'texas-el-paso': 'cusa',
            'rice': 'cusa',
            'charlotte': 'cusa',
            'buffalo': 'mac',
            'kent-state': 'mac',
            'miami-oh': 'mac',
            'bowling-green-state': 'mac',
            'ohio': 'mac',
            'akron': 'mac',
            'toledo': 'mac',
            'eastern-michigan': 'mac',
            'ball-state': 'mac',
            'western-michigan': 'mac',
            'central-michigan': 'mac',
            'northern-illinois': 'mac',
            'south-dakota-state': 'summit',
            'south-dakota': 'summit',
            'denver': 'summit',
            'ipfw': 'summit',
            'north-dakota-state': 'summit',
            'oral-roberts': 'summit',
            'nebraska-omaha': 'summit',
            'western-illinois': 'summit',
            'louisiana-lafayette': 'sun-belt',
            'georgia-state': 'sun-belt',
            'georgia-southern': 'sun-belt',
            'texas-arlington': 'sun-belt',
            'louisiana-monroe': 'sun-belt',
            'troy': 'sun-belt',
            'appalachian-state': 'sun-belt',
            'coastal-carolina': 'sun-belt',
            'texas-state': 'sun-belt',
            'south-alabama': 'sun-belt',
            'arkansas-state': 'sun-belt',
            'arkansas-little-rock': 'sun-belt',
            'college-of-charleston': 'colonial',
            'northeastern': 'colonial',
            'hofstra': 'colonial',
            'william-mary': 'colonial',
            'towson': 'colonial',
            'north-carolina-wilmington': 'colonial',
            'elon': 'colonial',
            'delaware': 'colonial',
            'drexel': 'colonial',
            'james-madison': 'colonial',
            'montana': 'big-sky',
            'idaho': 'big-sky',
            'weber-state': 'big-sky',
            'eastern-washington': 'big-sky',
            'northern-colorado': 'big-sky',
            'portland-state': 'big-sky',
            'idaho-state': 'big-sky',
            'montana-state': 'big-sky',
            'north-dakota': 'big-sky',
            'southern-utah': 'big-sky',
            'sacramento-state': 'big-sky',
            'northern-arizona': 'big-sky',
            'new-mexico-state': 'wac',
            'utah-valley': 'wac',
            'grand-canyon': 'wac',
            'seattle': 'wac',
            'texas-pan-american': 'wac',
            'cal-state-bakersfield': 'wac',
            'missouri-kansas-city': 'wac',
            'chicago-state': 'wac',
            'california-davis': 'big-west',
            'california-santa-barbara': 'big-west',
            'california-irvine': 'big-west',
            'cal-state-fullerton': 'big-west',
            'long-beach-state': 'big-west',
            'hawaii': 'big-west',
            'cal-poly': 'big-west',
            'california-riverside': 'big-west',
            'cal-state-northridge': 'big-west',
            'pennsylvania': 'ivy',
            'harvard': 'ivy',
            'yale': 'ivy',
            'cornell': 'ivy',
            'princeton': 'ivy',
            'columbia': 'ivy',
            'brown': 'ivy',
            'dartmouth': 'ivy',
            'rider': 'maac',
            'canisius': 'maac',
            'niagara': 'maac',
            'iona': 'maac',
            'fairfield': 'maac',
            'manhattan': 'maac',
            'quinnipiac': 'maac',
            'monmouth': 'maac',
            'saint-peters': 'maac',
            'siena': 'maac',
            'marist': 'maac',
            'north-carolina-greensboro': 'southern',
            'east-tennessee-state': 'southern',
            'furman': 'southern',
            'wofford': 'southern',
            'mercer': 'southern',
            'western-carolina': 'southern',
            'samford': 'southern',
            'citadel': 'southern',
            'virginia-military-institute': 'southern',
            'chattanooga': 'southern',
            'murray-state': 'ovc',
            'belmont': 'ovc',
            'austin-peay': 'ovc',
            'jacksonville-state': 'ovc',
            'tennessee-tech': 'ovc',
            'tennessee-state': 'ovc',
            'southeast-missouri-state': 'ovc',
            'eastern-illinois': 'ovc',
            'eastern-kentucky': 'ovc',
            'tennessee-martin': 'ovc',
            'southern-illinois-edwardsville': 'ovc',
            'morehead-state': 'ovc',
            'vermont': 'america-east',
            'maryland-baltimore-county': 'america-east',
            'hartford': 'america-east',
            'albany-ny': 'america-east',
            'stony-brook': 'america-east',
            'massachusetts-lowell': 'america-east',
            'new-hampshire': 'america-east',
            'maine': 'america-east',
            'binghamton': 'america-east',
            'northern-kentucky': 'horizon',
            'wright-state': 'horizon',
            'illinois-chicago': 'horizon',
            'oakland': 'horizon',
            'milwaukee': 'horizon',
            'iupui': 'horizon',
            'green-bay': 'horizon',
            'cleveland-state': 'horizon',
            'youngstown-state': 'horizon',
            'detroit-mercy': 'horizon',
            'north-carolina-asheville': 'big-south',
            'radford': 'big-south',
            'winthrop': 'big-south',
            'campbell': 'big-south',
            'liberty': 'big-south',
            'charleston-southern': 'big-south',
            'high-point': 'big-south',
            'gardner-webb': 'big-south',
            'presbyterian': 'big-south',
            'longwood': 'big-south',
            'bucknell': 'patriot',
            'colgate': 'patriot',
            'navy': 'patriot',
            'lehigh': 'patriot',
            'boston-university': 'patriot',
            'holy-cross': 'patriot',
            'lafayette': 'patriot',
            'army': 'patriot',
            'loyola-md': 'patriot',
            'american': 'patriot',
            'florida-gulf-coast': 'atlantic-sun',
            'lipscomb': 'atlantic-sun',
            'jacksonville': 'atlantic-sun',
            'njit': 'atlantic-sun',
            'north-florida': 'atlantic-sun',
            'kennesaw-state': 'atlantic-sun',
            'stetson': 'atlantic-sun',
            'south-carolina-upstate': 'atlantic-sun',
            'nicholls-state': 'southland',
            'southeastern-louisiana': 'southland',
            'stephen-f-austin': 'southland',
            'sam-houston-state': 'southland',
            'lamar': 'southland',
            'new-orleans': 'southland',
            'central-arkansas': 'southland',
            'abilene-christian': 'southland',
            'mcneese-state': 'southland',
            'texas-am-corpus-christi': 'southland',
            'incarnate-word': 'southland',
            'houston-baptist': 'southland',
            'northwestern-state': 'southland',
            'wagner': 'northeast',
            'saint-francis-pa': 'northeast',
            'mount-st-marys': 'northeast',
            'long-island-university': 'northeast',
            'st-francis-ny': 'northeast',
            'robert-morris': 'northeast',
            'fairleigh-dickinson': 'northeast',
            'central-connecticut-state': 'northeast',
            'sacred-heart': 'northeast',
            'bryant': 'northeast',
            'grambling': 'swac',
            'prairie-view': 'swac',
            'texas-southern': 'swac',
            'arkansas-pine-bluff': 'swac',
            'southern': 'swac',
            'jackson-state': 'swac',
            'alabama-state': 'swac',
            'alcorn-state': 'swac',
            'mississippi-valley-state': 'swac',
            'alabama-am': 'swac',
            'bethune-cookman': 'meac',
            'savannah-state': 'meac',
            'hampton': 'meac',
            'north-carolina-at': 'meac',
            'norfolk-state': 'meac',
            'north-carolina-central': 'meac',
            'morgan-state': 'meac',
            'howard': 'meac',
            'florida-am': 'meac',
            'south-carolina-state': 'meac',
            'coppin-state': 'meac',
            'maryland-eastern-shore': 'meac',
            'delaware-state': 'meac'
        }

        flexmock(utils) \
            .should_receive('_todays_date') \
            .and_return(MockDateTime(YEAR, MONTH))

        flexmock(Conferences) \
            .should_receive('_find_conferences') \
            .and_return(None)
        flexmock(Conferences) \
            .should_receive('team_conference') \
            .and_return(team_conference)

        self.teams = Teams()
Exemple #19
0
import os
import pandas as pd

from sportsreference.ncaab.teams import Teams
from sportsreference.ncaab.schedule import Schedule

errors = []

for year in range(2010, 2020):
    year = str(year)
    print(year)
    for team in Teams(year=year):
        try:
            df = pd.DataFrame()
            index = 0
            schedule = Schedule(team.abbreviation, year=year)
            for game in schedule:
                temp_df = pd.DataFrame(
                    {
                        'year': year,
                        'arena': game.arena,
                        'location': game.location,
                        'team': team.abbreviation,
                        'opponent': game.opponent_abbr,
                        'team_points': game.points_for,
                        'opponent_points': game.points_against
                    },
                    index=[index])
                df = pd.concat([df, temp_df], ignore_index=True)
                index += 1
            output_path = os.path.join('data', 'sportsreference_data',