コード例 #1
0
 def calculate_total_bachelors_or_higher_moe(row):
     if row['female_bachelors_or_higher_moe'] in list(MOE_MAP.values()):
         value = sum([
             row['female_bachelors_or_higher'],
             row['male_bachelors_or_higher']
         ])
         moe = None
     value, moe = census_data_aggregator.approximate_sum(
         (row['female_bachelors_degree'],
          row['female_bachelors_degree_moe']),
         (row['female_masters_degree'],
          row['female_masters_degree_moe']),
         (row['female_professional_school_degree'],
          row['female_professional_school_degree_moe']),
         (row['female_doctorate_degree'],
          row['female_doctorate_degree_moe']),
         (row['male_bachelors_degree'],
          row['male_bachelors_degree_moe']),
         (row['male_masters_degree'], row['male_masters_degree_moe']),
         (row['male_professional_school_degree'],
          row['male_professional_school_degree_moe']),
         (row['male_doctorate_degree'],
          row['male_doctorate_degree_moe']))
     row['total_bachelors_or_higher'] = value
     row['total_bachelors_or_higher_moe'] = moe
     return row
コード例 #2
0
 def calculate_asians_moe(row):
     pprint(row)
     if row['asian_alone_moe'] in list(MOE_MAP.values()):
         value = sum([row['asian_alone'], row['native_hawaiian_and_pacific_islander']])
         moe = None
     value, moe = census_data_aggregator.approximate_sum(
         (row['native_hawaiian_and_pacific_islander'], row['native_hawaiian_and_pacific_islander_moe']),
         (row['asian_alone'], row['asian_alone_moe']),
     )
     row['asians_all'] = value
     row['asians_all_moe'] = moe
     return row
コード例 #3
0
 def calculate_moe(row):
     pprint(row)
     if row['internet_without_subscription_moe'] in list(MOE_MAP.values()):
         value = sum([row['internet_without_subscription'], row['no_internet']])
         moe = None
     value, moe = census_data_aggregator.approximate_sum(
         (row['internet_without_subscription'], row['internet_without_subscription_moe']),
         (row['no_internet'], row['no_internet_moe']),
     )
     row['total_no_internet_and_no_subscription'] = value
     row['total_no_internet_and_no_subscription_moe'] = moe
     return row
コード例 #4
0
 def calculate_other_moe(row):
     pprint(row)
     if row['american_indian_and_alaska_native_moe'] in list(MOE_MAP.values()):
         value = sum([row['american_indian_and_alaska_native'], row['other_alone'], row['two_or_more_races']])
         moe = None
     value, moe = census_data_aggregator.approximate_sum(
         (row['american_indian_and_alaska_native'], row['american_indian_and_alaska_native_moe']),
         (row['other_alone'], row['other_alone_moe']),
         (row['two_or_more_races'], row['two_or_more_races_moe']),
     )
     row['other_all'] = value
     row['other_all_moe'] = moe
     return row
コード例 #5
0
 def calculate_moe(row):
     # our custom groups
     if row['us_citizen_by_naturalization_moe'] in list(
             MOE_MAP.values()):
         value = sum([
             row['us_citizen_by_naturalization'],
             row['us_citizen_born_abroad_american_parents'],
             row['us_citizen_born_puertorico_or_us_island_alone'],
             row['us_citizen_born_us']
         ])
         moe = None
     value, moe = census_data_aggregator.approximate_sum(
         (row['us_citizen_by_naturalization'],
          row['us_citizen_by_naturalization_moe']),
         (row['us_citizen_born_abroad_american_parents'],
          row['us_citizen_born_abroad_american_parents_moe']),
         (row['us_citizen_born_puertorico_or_us_island_alone'],
          row['us_citizen_born_puertorico_or_us_island_moe']),
         (row['us_citizen_born_us'], row['us_citizen_born_us_moe']),
     )
     row['us_citizen_total'] = value
     row['us_citizen_total_moe'] = moe
     return row