remember that because births is of integer typewe have to cast either the numerator or denominator to floating point to compute fraction (unless you are using python !the resulting complete data set now has the following columnsin [ ]names out[ ]int index entries to data columnsname non-null values sex non-null values births non-null values year non-null values prop non-null values dtypesfloat ( )int ( )object( when performing group operation like thisit' often valuable to do sanity checklike verifying that the prop column sums to within all the groups since this is floating point datause np allclose to check that the group sums are sufficiently close to (but perhaps not exactly equal to in [ ]np allclose(names groupby(['year''sex']prop sum() out[ ]true now that this is donei' going to extract subset of the data to facilitate further analysisthe top names for each sex/year combination this is yet another group operationdef get_top (group)return group sort_index(by='births'ascending=false)[: us baby names - www it-ebooks info