def natural_gas_consumption_location_heating_region_geometry_house_size( 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_size(df) df = util.assign_natural_gas_consumption(df) df = df.groupby([ 'Dependency=Location Heating Region', 'Dependency=Geometry House Size' ]) 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 House Size' ]).set_index([ 'Dependency=Location Heating Region', 'Dependency=Geometry House Size' ]) 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 natural_gas_consumption_location_heating_region(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_natural_gas_consumption(df) df = df.groupby(['Dependency=Location Heating Region']) 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'] return df
def natural_gas_consumption_location_heating_region(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_natural_gas_consumption(df) df = df.groupby(['Dependency=Location Heating Region']) 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'] return df
def natural_gas_consumption_geometry_stories(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_stories(df) df = util.assign_natural_gas_consumption(df) df = df.groupby(['Dependency=Geometry Stories']) 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 Stories']).set_index(['Dependency=Geometry Stories']) 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_stories(self, screen_scen): df = util.create_dataframe(self.session, rdb, screen_scen=screen_scen) df = util.assign_stories(df) df = util.assign_natural_gas_consumption(df) df = df.groupby(['Dependency=Geometry Stories']) 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 Stories']).set_index( ['Dependency=Geometry Stories']) return df
def natural_gas_consumption_location_heating_region_geometry_house_size(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_size(df) df = util.assign_natural_gas_consumption(df) df = df.groupby(['Dependency=Location Heating Region', 'Dependency=Geometry House Size']) 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 House Size']).set_index(['Dependency=Location Heating Region', 'Dependency=Geometry House Size']) return df