def statcase_data_parser(data_args): sc_parser = StatCastParser(**data_args) sc_data = sc_parser.get_data()[str(data_args['season'][0])][data_args['type']] keys = sc_data[0].keys() key_dict = {key:[] for key in keys} for data in sc_data: for key in data.keys(): key_dict[key].append(data[key]) df = pd.DataFrame(key_dict) return df
def statcase_data_parser(data_args): sc_parser = StatCastParser(**data_args) sc_data = sc_parser.get_data()[str( data_args['season'][0])][data_args['type']] keys = sc_data[0].keys() key_dict = {key: [] for key in keys} for data in sc_data: for key in data.keys(): key_dict[key].append(data[key]) df = pd.DataFrame(key_dict) return df
def get_data(self): fg_parser = FangraphParser(self.data_args) self.fg_data = fg_parser.get_db() sc_parser = StatCastParser(**self.data_args) self.sc_data = sc_parser.get_data()