First page Back Continue Last page Overview Graphics

Filtering Firstnames and Heights

import numpy as np

genders = ["male", "female"]

persons = []

with open("data/person_data.txt") as fh:

for line in fh:

persons.append(line.strip().split())

firstnames = {}

heights = {}

for gender in genders:

firstnames[gender] = [ x[0] for x in persons if x[4]==gender]

heights[gender] = [ x[2] for x in persons if x[4]==gender]

heights[gender] = np.array(heights[gender], np.int)