race_out_base = '../data/2016/SEFCU/sefcu_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) print(members.head()) racers = readers.parse_general(pd.read_fwf(race_name), header.RaceHeader.headers, 1) print(racers.head()) matchmember.match(members, racers, 3.55, 3.8) 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']) hmrrc['name'] = hmrrc.first_name + " " + hmrrc.last_name hmrrc.to_csv(race_out_name)
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']) hmrrc['name'] = hmrrc.first_name + " " + hmrrc.last_name hmrrc.to_csv(race_out_name)
import matchmember import runnerutils members = pd.read_csv( '../data/2017/Membership/2017-01-03 Members Hudson Mohawk Road Runners Club.csv' ) print(members.head()) racers_base = '../data/2017/1_HH/17Hangover_half' racers = pd.read_csv(racers_base + '.csv') print() print(racers.head()) matchmember.match(members, racers) print(racers.head()) hmrrc = racers[racers['member'] == 'yes'] hmrrc = hmrrc[['Place', 'FIRST_NAME', 'LAST_NAME', 'Sex', 'Age']] racers.head() hmrrc["age_cat"] = hmrrc.Age.apply(lambda x: runnerutils.ageToCat(x)) hmrrc = hmrrc.sort_values(['Sex', 'age_cat', 'Place']) hmrrc['name'] = hmrrc.FIRST_NAME + " " + hmrrc.LAST_NAME hmrrc.to_csv(racers_base + '_hmrrc.csv')