python/datasources/acs_population.py
def standardize_race_include_hispanic(self, df, total_frame):
        """Alternative format where race categories includ Hispanic/Latino.
           Totals are also included because summing over the column will give a
           larger number than the actual total."""
        by_hispanic = df.copy()
        group_by_cols = self.base_group_by_cols.copy()
        group_by_cols.append(HISPANIC_COL)
        by_hispanic = by_hispanic.groupby(group_by_cols).sum().reset_index()
        by_hispanic = by_hispanic.rename(columns={HISPANIC_COL: RACE_OR_HISPANIC_COL})

        by_race = df.copy()
        by_race[RACE_COL] = by_race[RACE_COL].apply(rename_race_value)
        group_by_cols = self.base_group_by_cols.copy()
        group_by_cols.append(RACE_COL)
        by_race = by_race.groupby(group_by_cols).sum().reset_index()
        by_race = by_race.rename(columns={RACE_COL: RACE_OR_HISPANIC_COL})

        combined = pandas.concat([by_hispanic, by_race, total_frame])
        return self.sort_race_frame(combined)
Alternative format where race categories includ Hispanic/Latino.
           Totals are also included because summing over the column will give a
           larger number than the actual total.
Alternative format where race categories includ Hispanic/Latino.
Totals are also included because summing over the column will give a
larger number than the actual total.
Alternative format where race categories includ Hispanic / Latino . Totals are also included because summing over the column will give a larger number than the actual total .
def standardize_race_include_hispanic(self, df, total_frame):
        by_hispanic = df.copy()
        group_by_cols = self.base_group_by_cols.copy()
        group_by_cols.append(HISPANIC_COL)
        by_hispanic = by_hispanic.groupby(group_by_cols).sum().reset_index()
        by_hispanic = by_hispanic.rename(columns={HISPANIC_COL: RACE_OR_HISPANIC_COL})
        by_race = df.copy()
        by_race[RACE_COL] = by_race[RACE_COL].apply(rename_race_value)
        group_by_cols = self.base_group_by_cols.copy()
        group_by_cols.append(RACE_COL)
        by_race = by_race.groupby(group_by_cols).sum().reset_index()
        by_race = by_race.rename(columns={RACE_COL: RACE_OR_HISPANIC_COL})
        combined = pandas.concat([by_hispanic, by_race, total_frame])
        return self.sort_race_frame(combined)
def standardize_race_include_hispanic ( self , df , total_frame ) : by_hispanic = df . copy ( ) group_by_cols = self . base_group_by_cols . copy ( ) group_by_cols . append ( HISPANIC_COL ) by_hispanic = by_hispanic . groupby ( group_by_cols ) . sum ( ) . reset_index ( ) by_hispanic = by_hispanic . rename ( columns = { HISPANIC_COL : RACE_OR_HISPANIC_COL } ) by_race = df . copy ( ) by_race [ RACE_COL ] = by_race [ RACE_COL ] . apply ( rename_race_value ) group_by_cols = self . base_group_by_cols . copy ( ) group_by_cols . append ( RACE_COL ) by_race = by_race . groupby ( group_by_cols ) . sum ( ) . reset_index ( ) by_race = by_race . rename ( columns = { RACE_COL : RACE_OR_HISPANIC_COL } ) combined = pandas . concat ( [ by_hispanic , by_race , total_frame ] ) return self . sort_race_frame ( combined )
Alternative format where race categories includ Hispanic/Latino.
Alternative format where race categories includ Hispanic / Latino .
"""Alternative format where race categories includ Hispanic/Latino.
           Totals are also included because summing over the column will give a
           larger number than the actual total."""
self
df
total_frame