def natural_gas_consumption_location_heating_region_geometry_foundation_type( self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_climate_zones(df) df = util.assign_heating_location(df) df = util.assign_vintage(df) df = util.assign_foundation_type(df) df = util.assign_natural_gas_consumption(df) df = df.groupby([ 'Dependency=Location Heating Region', 'Dependency=Geometry Foundation Type' ]) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['thm_nrm']].sum() df['Count'] = count df['Weight'] = weight df['thm_nrm_per_home'] = df['thm_nrm'] / df['Count'] df['thm_nrm_total'] = df['thm_nrm_per_home'] * df['Weight'] df = df.reset_index() df = df.sort_values(by=[ 'Dependency=Location Heating Region', 'Dependency=Geometry Foundation Type' ]).set_index([ 'Dependency=Location Heating Region', 'Dependency=Geometry Foundation Type' ]) return df
def natural_gas_consumption_location_heating_region_vintage( self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_climate_zones(df) df = util.assign_heating_location(df) df = util.assign_vintage(df) df = util.assign_natural_gas_consumption(df) df = df.groupby( ['Dependency=Location Heating Region', 'Dependency=Vintage']) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['thm_nrm']].sum() df['Count'] = count df['Weight'] = weight df['thm_nrm_per_home'] = df['thm_nrm'] / df['Count'] df['thm_nrm_total'] = df['thm_nrm_per_home'] * df['Weight'] df = df.reset_index() df['Dependency=Vintage'] = pd.Categorical( df['Dependency=Vintage'], ['<1950', '1950s', '1960s', '1970s', '1980s', '1990s', '2000s']) df = df.sort_values( by=['Dependency=Location Heating Region', 'Dependency=Vintage' ]).set_index([ 'Dependency=Location Heating Region', 'Dependency=Vintage' ]) return df
def vintage(self): df = util.assign_vintage(self.session) df = add_option_prefix(df) df = df[[ 'Option=<1950', 'Option=1950s', 'Option=1960s', 'Option=1970s', 'Option=1980s', 'Option=1990s', 'Option=2000s', 'Count', 'Weight' ]] return df
def natural_gas_consumption_vintage(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_vintage(df) df = util.assign_natural_gas_consumption(df) df = df.groupby(['Dependency=Vintage']) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['thm_nrm']].sum() df['Count'] = count df['Weight'] = weight df['thm_nrm_per_home'] = df['thm_nrm'] / df['Count'] df['thm_nrm_total'] = df['thm_nrm_per_home'] * df['Weight'] df = df.reset_index() df['Dependency=Vintage'] = pd.Categorical(df['Dependency=Vintage'], ['<1950', '1950s', '1960s', '1970s', '1980s', '1990s', '2000s']) df = df.sort_values(by=['Dependency=Vintage']).set_index(['Dependency=Vintage']) return df
def natural_gas_consumption_geometry_foundation_type(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_climate_zones(df) df = util.assign_heating_location(df) df = util.assign_vintage(df) df = util.assign_foundation_type(df) df = util.assign_natural_gas_consumption(df) df = df.groupby(['Dependency=Geometry Foundation Type']) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['thm_nrm']].sum() df['Count'] = count df['Weight'] = weight df['thm_nrm_per_home'] = df['thm_nrm'] / df['Count'] df['thm_nrm_total'] = df['thm_nrm_per_home'] * df['Weight'] df = df.reset_index() df = df.sort_values(by=['Dependency=Geometry Foundation Type']).set_index(['Dependency=Geometry Foundation Type']) return df
def electricity_consumption_location_heating_region_vintage(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_climate_zones(df) df = util.assign_heating_location(df) df = util.assign_vintage(df) df = util.assign_electricity_consumption(df) df = df.groupby(['Dependency=Location Heating Region', 'Dependency=Vintage']) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['kwh_nrm']].sum() df['Count'] = count df['Weight'] = weight df['kwh_nrm_per_home'] = df['kwh_nrm'] / df['Count'] df['kwh_nrm_total'] = df['kwh_nrm_per_home'] * df['Weight'] df = df.reset_index() df['Dependency=Vintage'] = pd.Categorical(df['Dependency=Vintage'], ['<1950', '1950s', '1960s', '1970s', '1980s', '1990s', '2000s']) df = df.sort_values(by=['Dependency=Location Heating Region', 'Dependency=Vintage']).set_index(['Dependency=Location Heating Region', 'Dependency=Vintage']) return df
def electricity_consumption_vintage(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_vintage(df) df = util.assign_electricity_consumption(df) df = df.groupby(['Dependency=Vintage']) count = df.agg(['count']).ix[:, 0] weight = df.agg(['sum'])['Weight'] df = df[['kwh_nrm']].sum() df['Count'] = count df['Weight'] = weight df['kwh_nrm_per_home'] = df['kwh_nrm'] / df['Count'] df['kwh_nrm_total'] = df['kwh_nrm_per_home'] * df['Weight'] df = df.reset_index() df['Dependency=Vintage'] = pd.Categorical( df['Dependency=Vintage'], ['<1950', '1950s', '1960s', '1970s', '1980s', '1990s', '2000s']) df = df.sort_values(by=['Dependency=Vintage']).set_index( ['Dependency=Vintage']) return df