Пример #1
0
def addPecotaBatterLine(line, player):
    newBatter = BatterYearLine()
    newBatter.player = player
    newBatter.label = "PECOTA Proj"
    newBatter.yearLabel = "2012"
    newBatter.age = line["AGE"]
    newBatter.atBats = line["AB"]
    newBatter.team = line["TEAM"]
    newBatter.league = line["LG"]
    newBatter.hits = line["H"]
    newBatter.doubles = line["2B"]
    newBatter.triples = line["3B"]
    newBatter.homeRuns = line["HR"]
    newBatter.runs = line["R"]
    newBatter.rbi = line["RBI"]
    newBatter.walks = line["BB"]
    newBatter.strikeouts = line["SO"]
    newBatter.stolenBases = line["SB"]
    newBatter.totalAvg = line["TAv"]
    newBatter.vorp = line["VORP"]
    newBatter.avg = line["AVG"]
    newBatter.obp = line["OBP"]
    newBatter.slg = line["SLG"]
    newBatter.totalBases = line["TB"]

    newBatter.player.curTeam = newBatter.team
    newBatter.player.save()
    newBatter.save()
Пример #2
0
def addBbhqBatterLine(line, player):
    newBatter = BatterYearLine()
    newBatter.player = player
    newBatter.label = 'BBHQ Proj'
    newBatter.yearLabel = '2012'
    newBatter.age = line['Age']
    newBatter.mmCode = line['MM Code']
    newBatter.dlDays = line['DL']
    newBatter.atBats = line['AB']
    newBatter.team = line['Tm']
    newBatter.hits = line['H']
    newBatter.doubles = line['2B']
    newBatter.triples = line['3B']
    newBatter.homeRuns = line['HR']
    newBatter.runs = line['R']
    newBatter.rbi = line['RBI']
    newBatter.walks = line['BB']
    newBatter.strikeouts = line['K']
    newBatter.stolenBases = line['SB']
    newBatter.dollarValue = line['12$']
    newBatter.avg = float(line['AVG']) / 1000.0
    newBatter.obp = float(line['OBP']) / 1000.0
    newBatter.slg = float(line['SLG']) / 1000.0
    newBatter.bbRatio = line['BB%']
    newBatter.contactRatio = float(line['Ct%']) / 100.0
    newBatter.eye = line['Eye']
    newBatter.px = line['PX']
    newBatter.groundBallRatio = line['G%']
    newBatter.lineDriveRatio = line['L%']
    newBatter.flyBallRatio = line['F%']
    newBatter.xba = float(line['XBA']) / 1000.0
    newBatter.bpv = line['BPV']
    newBatter.save()