def write_pitcher_evs(self): with open(dirs.dir_dict["results/pitcher_evs"]+misc.day_file_parse, "w") as f: writer = csv.writer(f) header = ["long_id"] + ["points","PTS"] + [me for m in params.monster_pitcher_ev_stats for me in [m, params.transform_keys[m]]] writer.writerow(header) for p in sorted(self.pitchers, key=lambda k: k.monster_stats["PTS"], reverse=True): # if "bullpen" in p.name: # continue to_write = [p.long_id] to_write += [misc.rps(me) for m in ["PTS"]+params.pitcher_ev_stats for me in [p.monster_stats[m], self.pitcher_ev_stats[p.long_id][m]]] writer.writerow(to_write) return None
def write_hitter_evs(self): with open(dirs.dir_dict["results/hitter_evs"]+misc.day_file_parse, "w") as f: writer = csv.writer(f) header = ["long"] + ["points","PTS"] + [me for m in params.monster_hitter_ev_stats for me in [m, params.transform_keys[m]]] writer.writerow(header) for h in sorted(self.hitters, key=lambda k: k.monster_stats["PTS"], reverse=True): if h.name == "Pitcher": continue to_write = [h.long_id] to_write += [misc.rps(me) for m in ["PTS"]+params.hitter_ev_stats for me in [h.monster_stats[m], self.hitter_ev_stats[h.long_id][m]]] writer.writerow(to_write) return None