コード例 #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
ファイル: nbaPredict.py プロジェクト: danj520/NBA-Predict
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)