예제 #1
0
def infoToDataFrame(dailyGames, meanDict, standardDeviationDict, startDate,
                    endDate, season):

    fullDataFrame = []
    gameNumber = 0  # Counter to match the result of the game with the correct game
    dailyResults = dailyGames[1]  # List of results for the games

    for homeTeam, awayTeam in dailyGames[0].items():

        homeTeamStats = getStatsForTeam(homeTeam, startDate, endDate, season)
        awayTeamStats = getStatsForTeam(awayTeam, startDate, endDate, season)

        currentGame = [homeTeam, awayTeam]

        for stat, statType in availableStats.items(
        ):  # Finds Z Score Dif for stats listed above and adds them to list
            zScoreDif = zScoreDifferential(homeTeamStats[stat],
                                           awayTeamStats[stat], meanDict[stat],
                                           standardDeviationDict[stat])
            currentGame.append(zScoreDif)

        if dailyResults[gameNumber] == 'W':  # Sets result to 1 if a win
            result = 1
        else:  # Sets result to 0 if loss
            result = 0

        currentGame.append(result)
        gameNumber += 1

        print(currentGame)
        fullDataFrame.append(
            currentGame
        )  # Adds this list to list of all games on specified date

    return (fullDataFrame)
예제 #2
0
def createMeanStandardDeviationDicts(startDate, endDate):

    meanDict = {}
    standardDeviationDict = {}

    # Loops through and inputs standard deviation and mean for each stat into dict
    for stat, statType in availableStats.items():
        statMean = basicOrAdvancedStatMean(startDate, endDate, stat, statType)
        meanDict.update({stat: statMean})

        statStandardDeviation = basicOrAdvancedStatStandardDeviation(startDate, endDate, stat, statType)
        standardDeviationDict.update({stat: statStandardDeviation})

    bothDicts = []
    bothDicts.append(meanDict)
    bothDicts.append(standardDeviationDict)

    return bothDicts
예제 #3
0
def dailyGamesDataFrame(dailyGames, meanDict, standardDeviationDict, startDate,
                        endDate):

    fullDataFrame = []

    for homeTeam, awayTeam in dailyGames.items():

        homeTeamStats = getStatsForTeam(homeTeam, startDate, endDate)
        awayTeamStats = getStatsForTeam(awayTeam, startDate, endDate)

        currentGame = [homeTeam, awayTeam]

        for stat, statType in availableStats.items(
        ):  # Finds Z Score Dif for stats listed above and adds them to list
            zScoreDif = zScoreDifferential(homeTeamStats[stat],
                                           awayTeamStats[stat], meanDict[stat],
                                           standardDeviationDict[stat])
            currentGame.append(zScoreDif)

        fullDataFrame.append(
            currentGame
        )  # Adds this list to list of all games on specified date

    return (fullDataFrame)