Пример #1
0
 def __init__(self):
     git_ = git.gen_ind_table('B25008')
     self.table = git_.gen_df()
     self.region = 'tract'
     self.total = git_.gen_total()
     self.table['total'] = self.total.total.astype(float)
     self.table.iloc[:, 4:] = self.table.iloc[:, 4:].astype(float)
Пример #2
0
 def __init__(self):
     table = git.gen_ind_table('B01001')
     left = table.gen_df().iloc[:, :4]
     total = table.gen_total()
     table = table.gen_df()
     aged_col = table.columns[[6, 7, 9]]
     table = table.loc[:, aged_col].astype(float).apply(np.sum, axis=1)
     table = pd.concat([left, table, total.total],
                       axis=1).rename(columns={0: '>65'})
     table['total'] = table['total'].astype(float)
     self.table = table
     self.region = 'tract'
     self.total = total
Пример #3
0
 def __init__(self):
     git_ = git.gen_ind_table('C17002')
     self.table = git_.gen_df()
     self.region = 'tract'
     self.total = git_.gen_total()
     self.table['total'] = self.total.total.astype(float)
     self.table.iloc[:, 4:] = self.table.iloc[:, 4:].astype(float)
     self.table['>2x_poverty'] = self.table[['2.00 and over']]
     self.table['>poverty'] = self.table[[
         '1.85 to 1.99', '1.00 to 1.24', '1.50 to 1.84', '1.25 to 1.49'
     ]].apply(np.sum, axis=1)
     self.table['<poverty'] = self.table[['Under .50',
                                          '.50 to .99']].apply(np.sum,
                                                               axis=1)
     self.table = self.table[self.table.columns.to_list()[:4] +
                             ['>2x_poverty', '>poverty', '<poverty'] +
                             ['total']]
Пример #4
0
    def __init__(self):
        git_ = git.gen_ind_table('B25070')
        self.table = git_.gen_df()
        self.region = 'tract'
        self.total = git_.gen_total()
        self.table['total'] = self.total.total.astype(float)
        self.table.iloc[:, 4:] = self.table.iloc[:, 4:].astype(float)
        self.table['Greater than 30 percent'] = self.table[[
            '30.0 to 34.9 percent', '40.0 to 49.9 percent',
            '35.0 to 39.9 percent', '50.0 percent or more'
        ]].apply(np.sum, axis=1)

        self.table['Less than 30 percent'] = self.table[[
            '10.0 to 14.9 percent', 'Less than 10.0 percent',
            '25.0 to 29.9 percent', '20.0 to 24.9 percent',
            '15.0 to 19.9 percent'
        ]].apply(np.sum, axis=1)

        self.table = self.table[
            self.table.columns.to_list()[:4] +
            ['Less than 30 percent', 'Greater than 30 percent'] + ['total']]
Пример #5
0
 def __init__(self):
     git_ = git.gen_ind_table('B15003')
     df = git_.gen_df()
     col1 = ['Nursery school', 'No schooling completed', '5th grade', '3rd grade', '4th grade', '2nd grade', '1st grade', 'Kindergarten','8th grade', '7th grade', '6th grade']
     col2 = ['11th grade', '10th grade', '9th grade', 'GED or alternative credential', 'Regular high school diploma', '12th grade, no diploma']
     col3 = ["Bachelor's degree", "Associate's degree", "Some college, 1 or more years, no degree",'Some college, less than 1 year']
     col4 = ['Doctorate degree','Professional school degree', "Master's degree"]
     df['below 9th grade'] = df.loc[:, col1].apply(np.sum, axis =1)
     df.drop(col1, axis = 1, inplace = True)
     df['some highschool'] = df.loc[:, col2].apply(np.sum, axis =1)
     df.drop(col2, axis = 1, inplace = True)
     df['some college'] = df.loc[:, col3].apply(np.sum, axis = 1)
     df.drop(col3, axis = 1, inplace = True)
     df['advanced degree'] = df.loc[:, col4].apply(np.sum, axis = 1)
     df.drop(col4, axis = 1, inplace = True)
     df = df[['FIPS', 'Tract', 'County', 'State', 'below 9th grade', 'some highschool',
              'some college', 'advanced degree', 'total']]
     self.table = df
     self.region = 'tract'
     self.total = git_.gen_total()
     self.table['total'] = self.total.total.astype(float)
     self.table.iloc[:, 4:] = self.table.iloc[:, 4:].astype(float)