race_name = '../data/2016/Stockade/stockade2.csv' race_out_base = '../data/2016/Stockade/stockade_scored' race_out_name = race_out_base + '.csv' race_out_males = race_out_base + '_males.csv' race_out_females = race_out_base + '_females.csv' members = pd.read_csv(members_name) members["age"] = members['Birthdate (e.g., 01 Jun 1954)'].apply( lambda x: utils.datestring_to_age(x)) members["gender"] = members['Gender'].apply(lambda x: utils.parse_gender(x)) print(members.head()) racers = readers.parse_general(pd.read_csv(race_name), header.RaceHeader.headers, 1) #racers=pd.read_csv(race_name) print(racers.head()) matchmember.match(members, racers, 4.5, 5.5) print(racers.head()) hmrrc = racers[racers['member'] == 'yes'] hmrrc = hmrrc[['place', 'first_name', 'last_name', 'gender', 'age']] racers.head() hmrrc["age_cat"] = hmrrc.age.apply(lambda x: runnerutils.ageToCat(x)) hmrrc = hmrrc.sort_values(['gender', 'age_cat', 'place'])
sys.path.append('../util/race/') import header imp.reload(header) from header import RaceHeader import pandas as pd import readers imp.reload(readers) from localflavor.us.models import USStateField # open hangover hald hh = pd.read_csv('../data/2019/1_HH/HH.csv') stockade = pd.read_csv('../data/2018/11_Stockade/stockade.csv') hh = readers.parse_general(hh, header.RaceHeader.headers, 1) stockade = readers.parse_general(stockade, header.RaceHeader.headers, 1) # open stockadeathon print(stockade.head()) print(hh.head()) print('ok') Race.objects.all().delete() Result.objects.all().delete() race1 = Race(race_name='Hangover Half', race_date='2019-01-01', city='Albany', state=USStateField('NY'))