Skip to content

Commit

Permalink
Minor variable rename
Browse files Browse the repository at this point in the history
  • Loading branch information
vkoves committed Mar 13, 2024
1 parent 95fc828 commit 031e4ea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 28 deletions.
11 changes: 5 additions & 6 deletions src/data/scripts/clean_and_pare_down_data_all_years.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
def rename_columns(building_data: pd.DataFrame) -> pd.DataFrame:
return building_data.rename(columns=replace_headers)

def get_all_ghg_data(building_data: pd.DataFrame) -> pd.DataFrame:
def get_buildings_with_ghg_intensity(building_data: pd.DataFrame) -> pd.DataFrame:
return building_data.loc[(building_data['GHGIntensity'] > 0)].copy()

def get_submitted_data(building_data: pd.DataFrame) -> pd.DataFrame:
Expand Down Expand Up @@ -94,17 +94,17 @@ def output_to_csv(building_data: pd.DataFrame, dir: str) -> None:

def process(file_path: str) -> pd.DataFrame:
building_data = get_and_clean_csv(file_path)

building_data = rename_columns(building_data)

all_ghg_data = get_all_ghg_data(building_data)
buildings_with_ghg_intensity = get_buildings_with_ghg_intensity(building_data)

all_submitted_data = get_submitted_data(all_ghg_data)
all_submitted_data = get_submitted_data(buildings_with_ghg_intensity)

all_recent_submitted_data = get_last_year_data(all_submitted_data)

all_recent_submitted_data = fix_str_cols(all_recent_submitted_data, building_data)

all_recent_submitted_data = fix_int_cols(all_recent_submitted_data)

return all_recent_submitted_data
Expand All @@ -115,4 +115,3 @@ def main():

if __name__ == '__main__':
main()

44 changes: 22 additions & 22 deletions tests/data/source/test_src_data.csv
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Data Year,ID,Property Name,Reporting Status,Address,ZIP Code,Chicago Energy Rating,Exempt From Chicago Energy Rating,Community Area,Primary Property Type,Gross Floor Area - Buildings (sq ft),Year Built,# of Buildings,Water Use (kGal),ENERGY STAR Score,Electricity Use (kBtu),Natural Gas Use (kBtu),District Steam Use (kBtu),District Chilled Water Use (kBtu),All Other Fuel Use (kBtu),Site EUI (kBtu/sq ft),Source EUI (kBtu/sq ft),Weather Normalized Site EUI (kBtu/sq ft),Weather Normalized Source EUI (kBtu/sq ft),Total GHG Emissions (Metric Tons CO2e),GHG Intensity (kg CO2e/sq ft),Latitude,Longitude,Location,Row_ID,Wards,Community Areas,Zip Codes,Census Tracts,Historical Wards 2003-2015
2020,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2020-256458,46,29,21184,90,41
2020,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,,2289000,,,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2020-100856,46,29,21184,90,41
2020,160196,The Art Institute of Chicago,Submitted Data,111 S Michigan Ave,60603,2.0,false,LOOP,Museum,1008416,1892,1,,,79096897.3,160912625.4,,,,238,387.2,240.8,390.1,20891.4,20.7,41.880452,-87.624229,"(41.880452, -87.624229)",2020-160196,36,38,14311,367,22
2020,256419,Crown Hall,Submitted Data,3360 S State Street,60616,4.0,false,DOUGLAS,College/University,54291,1955,1,,,1033900.8,,5517241.1,,,120.7,175.6,127.9,184.3,527.7,9.7,41.842325,-87.62715344,"(41.842325, -87.62715344)",2020-256419,9,1,21194,377,12
2017,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,2,,,111594203,8070756,,,,124.7,373.8,125.2,374.4,21061.9,21.9,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2017-100856,46,29,21184,90,41
2017,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,84934097,159962683,,,,242.9,431,247.3,435,24200.3,24,41.880452,-87.624229,"(41.880452, -87.624229)",2017-160196,36,38,14311,367,22
2015,160196,Art Institute of Chicago,Submitted,111 S. Michigan Ave.,60603,,,LOOP,Museum,1113416,1892,1,,,88935350,177925468,,,,239.7,418.6,243.4,422.5,27319,24.5,41.880451999999998,-87.624229,"(41.880452, -87.624229)",2015-160196,36,38,14311,367,22
2018,256419,Crown Hall,Not Submitted,3360 South State st,60616,0.0,false,DOUGLAS,College/University,54291,1955,1,,,,,,,,,,,,,,41.842325,-87.62715344,"(41.842325, -87.62715344)",2018-256419,9,1,21194,377,12
2014,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,94822312,158283369,,,,251,460,248,457,27458,27.23,41.880452,-87.624229,"(41.880452, -87.624229)",2014-160196,36,38,14311,367,22
2018,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,657,,89812131.2,169797846.5,,,,257.4,426.2,257.7,426.5,23960.3,23.8,41.880452,-87.624229,"(41.880452, -87.624229)",2018-160196,36,38,14311,367,22
2015,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,1,,,11479770,12102665,,,,24.6,50.8,,,2949,3.1,41.880676719999997,-87.674182070000001,"(41.88067672, -87.67418207)",2015-100856,46,29,21184,90,41
2016,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,91317062,160204044.6,,,,249.4,451.2,254.1,453,25340.9,25.1,41.880452,-87.624229,"(41.880452, -87.624229)",2016-160196,36,38,14311,367,22
2018,100856,United Center,Submitted,1901 West Madison St.,60612,4.0,false,NEAR WEST SIDE,Indoor Arena,960000,1994,2,12929,,11345016,9342860.4,,,,21.5,43.3,21.6,43.4,2383.6,2.5,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2018-100856,46,29,21184,90,41
2016,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,1,,,113634101,8970953,,,,127.7,381.5,128.5,382.3,21421.7,22.3,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2016-100856,46,29,21184,90,41
2019,100856,United Center,Submitted,1901 W Madison St,60612,2.0,false,NEAR WEST SIDE,Indoor Arena,960000,1994,2,206239,,102653875.6,15169580.2,,,,122.7,316,122.4,,17883.7,18.6,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2019-100856,46,29,21184,90,41
2019,160196,The Art Institute of Chicago,Submitted,111 S Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,,,89515423.6,174620529.5,,,,261.9,430.4,260.4,,24167.1,24,41.880452,-87.624229,"(41.880452, -87.624229)",2019-160196,36,38,14311,367,22
2019,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1776182.8,,6264685,,,148.1,230.4,145.5,,711.5,13.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2019-256419,9,1,21194,377,12
2021,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,Indoor Arena,2289000,1994,1,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2021-100856,46,29,21184,90,41
2021,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1333307.2,0,451039945.6,0,,8332.4,10063.4,8332.4,10063.4,30138.8,555.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2021-256419,9,1,21194,377,12
2021,160196,The Art Institute of Chicago,Not Submitted,111 S Michigan Ave,60603,0.0,false,LOOP,Museum,1008416,1892,1,,,,,,,,,,,,,,41.880452,-87.624229,"(41.880452, -87.624229)",2021-160196,36,38,14311,367,22
2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41
Data Year,ID,Property Name,Reporting Status,Address,ZIP Code,Chicago Energy Rating,Exempt From Chicago Energy Rating,Community Area,Primary Property Type,Gross Floor Area - Buildings (sq ft),Year Built,# of Buildings,Water Use (kGal),ENERGY STAR Score,Electricity Use (kBtu),Natural Gas Use (kBtu),District Steam Use (kBtu),District Chilled Water Use (kBtu),All Other Fuel Use (kBtu),Site EUI (kBtu/sq ft),Source EUI (kBtu/sq ft),Weather Normalized Site EUI (kBtu/sq ft),Weather Normalized Source EUI (kBtu/sq ft),Total GHG Emissions (Metric Tons CO2e),GHG Intensity (kg CO2e/sq ft),Latitude,Longitude,Location,Row_ID,Wards,Community Areas,Zip Codes,Census Tracts,Historical Wards 2003-2015
2020,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2020-256458,46,29,21184,90,41
2020,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,,2289000,,,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2020-100856,46,29,21184,90,41
2020,160196,The Art Institute of Chicago,Submitted Data,111 S Michigan Ave,60603,2.0,false,LOOP,Museum,1008416,1892,1,,,79096897.3,160912625.4,,,,238,387.2,240.8,390.1,20891.4,20.7,41.880452,-87.624229,"(41.880452, -87.624229)",2020-160196,36,38,14311,367,22
2020,256419,Crown Hall,Submitted Data,3360 S State Street,60616,4.0,false,DOUGLAS,College/University,54291,1955,1,,,1033900.8,,5517241.1,,,120.7,175.6,127.9,184.3,527.7,9.7,41.842325,-87.62715344,"(41.842325, -87.62715344)",2020-256419,9,1,21194,377,12
2017,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,2,,,111594203,8070756,,,,124.7,373.8,125.2,374.4,21061.9,21.9,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2017-100856,46,29,21184,90,41
2017,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,84934097,159962683,,,,242.9,431,247.3,435,24200.3,24,41.880452,-87.624229,"(41.880452, -87.624229)",2017-160196,36,38,14311,367,22
2015,160196,Art Institute of Chicago,Submitted,111 S. Michigan Ave.,60603,,,LOOP,Museum,1113416,1892,1,,,88935350,177925468,,,,239.7,418.6,243.4,422.5,27319,24.5,41.880451999999998,-87.624229,"(41.880452, -87.624229)",2015-160196,36,38,14311,367,22
2018,256419,Crown Hall,Not Submitted,3360 South State st,60616,0.0,false,DOUGLAS,College/University,54291,1955,1,,,,,,,,,,,,,,41.842325,-87.62715344,"(41.842325, -87.62715344)",2018-256419,9,1,21194,377,12
2014,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,94822312,158283369,,,,251,460,248,457,27458,27.23,41.880452,-87.624229,"(41.880452, -87.624229)",2014-160196,36,38,14311,367,22
2018,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,657,,89812131.2,169797846.5,,,,257.4,426.2,257.7,426.5,23960.3,23.8,41.880452,-87.624229,"(41.880452, -87.624229)",2018-160196,36,38,14311,367,22
2015,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,1,,,11479770,12102665,,,,24.6,50.8,,,2949,3.1,41.880676719999997,-87.674182070000001,"(41.88067672, -87.67418207)",2015-100856,46,29,21184,90,41
2016,160196,The Art Institute of Chicago,Submitted,111 South Michigan Ave,60603,,,LOOP,Museum,1008416,1892,1,,,91317062,160204044.6,,,,249.4,451.2,254.1,453,25340.9,25.1,41.880452,-87.624229,"(41.880452, -87.624229)",2016-160196,36,38,14311,367,22
2018,100856,United Center,Submitted,1901 West Madison St.,60612,4.0,false,NEAR WEST SIDE,Indoor Arena,960000,1994,2,12929,,11345016,9342860.4,,,,21.5,43.3,21.6,43.4,2383.6,2.5,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2018-100856,46,29,21184,90,41
2016,100856,United Center,Submitted,1901 West Madison St.,60612,,,NEAR WEST SIDE,Indoor Arena,960000,1994,1,,,113634101,8970953,,,,127.7,381.5,128.5,382.3,21421.7,22.3,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2016-100856,46,29,21184,90,41
2019,100856,United Center,Submitted,1901 W Madison St,60612,2.0,false,NEAR WEST SIDE,Indoor Arena,960000,1994,2,206239,,102653875.6,15169580.2,,,,122.7,316,122.4,,17883.7,18.6,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2019-100856,46,29,21184,90,41
2019,160196,The Art Institute of Chicago,Submitted,111 S Michigan Ave,60603,1.0,false,LOOP,Museum,1008416,1892,1,,,89515423.6,174620529.5,,,,261.9,430.4,260.4,,24167.1,24,41.880452,-87.624229,"(41.880452, -87.624229)",2019-160196,36,38,14311,367,22
2019,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1776182.8,,6264685,,,148.1,230.4,145.5,,711.5,13.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2019-256419,9,1,21194,377,12
2021,100856,United Center,Not Submitted,1901 W Madison St,60612,0.0,false,NEAR WEST SIDE,Indoor Arena,2289000,1994,1,,,,,,,,,,,,,,41.88067672,-87.67418207,"(41.88067672, -87.67418207)",2021-100856,46,29,21184,90,41
2021,256419,Crown Hall,Submitted,3360 S State Street,60616,1.0,false,DOUGLAS,College/University,54291,1955,1,,,1333307.2,0,451039945.6,0,,8332.4,10063.4,8332.4,10063.4,30138.8,555.1,41.842325,-87.62715344,"(41.842325, -87.62715344)",2021-256419,9,1,21194,377,12
2021,160196,The Art Institute of Chicago,Not Submitted,111 S Michigan Ave,60603,0.0,false,LOOP,Museum,1008416,1892,1,,,,,,,,,,,,,,41.880452,-87.624229,"(41.880452, -87.624229)",2021-160196,36,38,14311,367,22
2021,256458,United Center Office Building,Not Submitted,1901 W Madison St,60612,0.0,false,,,,,,,,,,,,,,,,,,,41.88125398,-87.67448493,"(41.88125398, -87.67448493)",2021-256458,46,29,21184,90,41

0 comments on commit 031e4ea

Please sign in to comment.