Пример #1
0
def addPecotaPitcherLine(line, player):
    newPitcher = PitcherYearLine()
    newPitcher.player = player
    newPitcher.label = "PECOTA Proj"
    newPitcher.yearLabel = "2012"
    newPitcher.age = line["AGE"]
    newPitcher.team = line["TEAM"]
    newPitcher.league = line["LG"]
    newPitcher.inningsPitched = line["IP"]
    newPitcher.era = line["ERA"]
    newPitcher.hitsAllowed = line["H"]
    newPitcher.walksAllowed = line["BB"]
    newPitcher.strikeouts = line["SO"]
    newPitcher.wins = line["W"]
    newPitcher.saves = line["SV"]
    newPitcher.fairRa = line["FAIR_RA"]
    newPitcher.warp = line["WARP"]
    newPitcher.games = line["G"]
    newPitcher.gamesStarted = line["GS"]
    newPitcher.qualityStarts = line["QS"]
    newPitcher.whip = (float(newPitcher.walksAllowed) + float(newPitcher.hitsAllowed)) / float(
        newPitcher.inningsPitched
    )
    newPitcher.bb9 = line["BB9"]
    newPitcher.k9 = line["SO9"]
    newPitcher.kbbRatio = float(newPitcher.strikeouts) / float(newPitcher.walksAllowed)

    if newPitcher.games <= newPitcher.gamesStarted * 2:
        newPitcher.player.pos = "SP"
    else:
        newPitcher.player.pos = "RP"

    newPitcher.player.curTeam = newPitcher.team
    newPitcher.player.save()
    newPitcher.save()
Пример #2
0
def addBbhqPitcherLine(line, player):
    newPitcher = PitcherYearLine()
    newPitcher.player = player
    newPitcher.label = 'BBHQ Proj'
    newPitcher.yearLabel = '2012'
    newPitcher.age = line['Age']
    newPitcher.team = line['Tm']
    newPitcher.mmCode = line['MM Code']
    newPitcher.dlDays = line['DL']
    newPitcher.inningsPitched = line['IP']
    newPitcher.era = line['ERA']
    newPitcher.xera = line['xERA']
    newPitcher.hitsAllowed = line['H']
    newPitcher.earnedRuns = line['ER']
    newPitcher.walksAllowed = line['BB']
    newPitcher.strikeouts = line['K']
    newPitcher.wins = line['W']
    newPitcher.saves = line['Sv']
    newPitcher.dollarValue = line['12$']
    newPitcher.games = line['G']
    newPitcher.qualityStarts = line['QS']
    newPitcher.whip = line['WHIP']
    newPitcher.bb9 = line['BB9']
    newPitcher.k9 = line['K9']
    newPitcher.kbbRatio = float(newPitcher.strikeouts) / float(newPitcher.walksAllowed)
    newPitcher.groundBallRatio = line['G%']
    newPitcher.lineDriveRatio = line['L%']
    newPitcher.flyBallRatio = line['F%']
    newPitcher.hitRatio = line['H%']
    newPitcher.bpv = line['BPV']

    newPitcher.player.save()
    newPitcher.save()