# '#' is the comment sign in Python. Any code after it won't be excuted. #import sys #reload(sys) #sys.setdefaultencoding('utf-8')'''

In [92]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
pd.__version__


Out[2]:
'0.16.0'

In [3]:
%time energyxlsx = pd.ExcelFile('bps_energy_consumption_2011_2012.xlsx', encoding ='utf-8')


CPU times: user 29.5 s, sys: 289 ms, total: 29.8 s
Wall time: 31.6 s

In [4]:
sheetnames = energyxlsx.sheet_names
sheetnames


Out[4]:
[u'2011 Raw', u'2011 Normalized ', u'2012 Raw', u'2012 Normalized']

In [5]:
sheetnames[0]


Out[5]:
u'2011 Raw'

In [6]:
#newsheetnames = ['df'+ i.replace(' ','') for i in sheetnames]
#newsheetnames

In [7]:
dfraw2011 = energyxlsx.parse(sheetnames[0])
dfnor2011 = energyxlsx.parse(sheetnames[1])
dfraw2012 = energyxlsx.parse(sheetnames[2])
dfnor2012 = energyxlsx.parse(sheetnames[3])

In [8]:
whos


Variable     Type         Data/Info
-----------------------------------
dfnor2011    DataFrame                             <...>n[15608 rows x 7 columns]
dfnor2012    DataFrame                             <...>n[16891 rows x 7 columns]
dfraw2011    DataFrame                            O<...>[18743 rows x 41 columns]
dfraw2012    DataFrame                             <...>[17978 rows x 39 columns]
energyxlsx   ExcelFile    <pandas.io.excel.ExcelFile object at 0x1061e7910>
np           module       <module 'numpy' from '/Us<...>ages/numpy/__init__.pyc'>
pd           module       <module 'pandas' from '/U<...>ges/pandas/__init__.pyc'>
plt          module       <module 'matplotlib.pyplo<...>s/matplotlib/pyplot.pyc'>
sheetnames   list         n=4

In [9]:
dfraw2011


Out[9]:
Organization Name Sector Name SubSector Name Operation Name Operation Type Address City ZIP/Postal Code Total Floor Area Unit1 ... Unit10 Renewable2 Emission Factor2 Swimming Pool Number of Portables GHG Emissions(Kg) Energy Intensity (GJ/Mega Litres) Energy Intensity (ekWh/sqft) Energy Intensity (GJ/m2) Energy Intensity (ekWh/Mega Litres)
0 Town of Goderich Municipal Municipality Municipal Office Administrative offices and related facilities,... 57 West Street Goderich N7A 2K5 21510.00 Square feet ... NaN 0 NaN 0 NaN 24740.490790 NaN 11.650264 0.451463 NaN
1 Town of Goderich Municipal Municipality Goderich Library Public libraries 52 Montreal Street Goderich N7A 2K5 1100.00 Square meters ... NaN 0 NaN 0 NaN 45163.116457 NaN 25.237567 0.977989 NaN
2 Town of Goderich Municipal Municipality Water Treatment Plant Facilities related to the treatment of water 100 Cove Rd Goderich N7A 2K5 733.00 Square meters ... NaN 0 NaN 0 NaN 97528.525320 2.547766 126.078258 4.885701 707.712764
3 Town of Goderich Municipal Municipality Elevated Tank Facilities related to the pumping of water 220 St David Street Goderich N7A 2K5 63.00 Square meters ... NaN 0 NaN 0 NaN 1521.482760 55.868400 22.884372 0.886800 15519.000000
4 Town of Goderich Municipal Municipality Reservoir-Booster Pump Station Facilities related to the pumping of water 371 Parsons Court Goderich N7A 2K5 184.00 Square meters ... NaN 0 NaN 0 NaN 12154.214880 446.299196 62.592400 2.425539 123972.000000
5 Town of Goderich Municipal Municipality Water Pollution Control Plant Facilities related to the treatment of sewage 211 Sunset Drive Goderich N7A 2K5 619.00 Square meters ... NaN 0 NaN 0 NaN 85348.449649 1.168373 123.245078 4.775911 324.547987
6 Town of Goderich Municipal Municipality Sewage Pump Station - North Dock Facilities related to the pumping of sewage North Harbour Rd Goderich N7A 2K5 3.00 Square meters ... NaN 0 NaN 0 NaN 469.023360 17.222400 148.144570 5.740800 4784.000000
7 Town of Goderich Municipal Municipality Goderich OPP Station Police stations and associated offices and fac... 50 The Square Goderich N7A 2K5 210.00 Square meters ... NaN 0 NaN 0 NaN 11700.322681 NaN 39.651140 1.536535 NaN
8 Town of Goderich Municipal Municipality Fire Hall Fire stations and associated offices and facil... 248 Suncoast Dr East Goderich N7A 2K5 644.00 Square meters ... NaN 0 NaN 0 NaN 35852.885859 NaN 30.438396 1.179529 NaN
9 Town of Goderich Municipal Municipality Airport Shed Storage facilities where equipment or vehicles... 33868B Airport Rd Goderich N7A 2K5 418.00 Square meters ... NaN 0 NaN 0 NaN 13315.539512 NaN 13.411728 0.519722 NaN
10 Town of Goderich Municipal Municipality Parks Building Storage facilities where equipment or vehicles... 371 Parsons Court Goderich N7A 2K5 368.00 Square meters ... NaN 0 NaN 0 NaN 7380.108977 NaN 11.494148 0.445414 NaN
11 Town of Goderich Municipal Municipality Public Works Garage Storage facilities where equipment or vehicles... 361 Cambridge Goderich N7A 2K5 650.00 Square meters ... NaN 0 NaN 0 NaN 33739.717309 NaN 29.215121 1.132125 NaN
12 Town of Goderich Municipal Municipality Cemetery Shed Storage facilities where equipment or vehicles... 35454 Huron Rd Goderich N7A 2K5 128.00 Square meters ... NaN 0 NaN 0 NaN 954.517440 NaN 7.066208 0.273825 NaN
13 Town of Goderich Municipal Municipality Tourism Centre Administrative offices and related facilities,... 93 Hamilton St Goderich N7A 2K5 60.00 Square meters ... NaN 0 NaN 0 NaN 4817.920610 NaN 47.857891 1.854557 NaN
14 Town of Goderich Municipal Municipality Day Care Centre Community centres 376 Cambridge St Goderich N7A 2K5 1000.00 Square meters ... NaN 0 NaN 0 NaN 29856.317732 NaN 18.155556 0.703552 NaN
15 Town of Goderich Municipal Municipality Airport Terminal Administrative offices and related facilities,... 33868A Airport Rd Goderich N7A 2K5 149.00 Square meters ... NaN 0 NaN 0 NaN 7727.874811 NaN 37.289719 1.445026 NaN
16 McMaster University Post-Secondary Educational Institution University McMaster Uiniversity Classrooms and related facilities 1280 Main Street West Hamilton L8S 4M3 4615818.22 Square feet ... Giga Joule - chilled water 0 NaN 0 NaN 51553968.866805 NaN 67.573076 2.618548 NaN
17 Nipigon District Memorial Hospital Public Hospital Acute/Chronic Nipigon District Memorial Hospital Facilities used for hospital purposes 125 Hogan Road Nipigon P0T 2J0 55394.00 Square feet ... NaN 0 NaN 0 NaN 781576.142289 NaN 95.847872 3.714234 NaN
18 Nipigon District Memorial Hospital Public Hospital Acute/Chronic Nipigon Medical Clinic Administrative offices and related facilities 125 Hogan Road Nipigon P0T 2J0 4125.00 Square feet ... NaN 0 NaN 0 NaN 13346.833266 NaN 27.970523 1.083895 NaN
19 Regional Municipality of Durham Municipal Municipality Duffin Creek WPCP Facilities related to the treatment of sewage 901 McKay Rd. Pickering L1W 3A3 NaN NaN ... NaN 0 NaN 0 NaN 20977710.033940 3.927439 NaN NaN 1090.955239
20 Regional Municipality of Durham Municipal Municipality Corbett Creek WPCP Facilities related to the treatment of sewage 2400 Forbes St. Whitby L1N 8M3 NaN NaN ... NaN 0 NaN 0 NaN 1114936.180233 2.084496 NaN NaN 579.026645
21 Regional Municipality of Durham Municipal Municipality Courtice WPCP Facilities related to the treatment of sewage 100 Osbourne Rd Courtice L1E 2R3 NaN NaN ... NaN 0 NaN 0 NaN 1173685.413738 2.358233 NaN NaN 655.064656
22 Regional Municipality of Durham Municipal Municipality Harmony Creek WPCP Facilities related to the treatment of sewage 785 Colonel Sam Dr. Oshawa L1H 8S2 NaN NaN ... NaN 0 NaN 0 NaN 841807.771932 3.065192 NaN NaN 851.442151
23 Regional Municipality of Durham Municipal Municipality Port Darlington WPCP Facilities related to the treatment of sewage 93 Port Darlington Rd. Bowmanville L1C 3K3 NaN NaN ... NaN 0 NaN 0 NaN 527180.022741 2.712064 NaN NaN 753.351015
24 Regional Municipality of Durham Municipal Municipality Newcastle WPCP Facilities related to the treatment of sewage 1000 Toronto St. Newcastle L1B 0A6 NaN NaN ... NaN 0 NaN 0 NaN 321481.732392 7.604179 NaN NaN 2112.271975
25 Regional Municipality of Durham Municipal Municipality Lake Simcoe WPCP Facilities related to the treatment of sewage 885 Concession 5 Beaverton L0K 1A0 NaN NaN ... NaN 0 NaN 0 NaN 300350.119440 10.302825 NaN NaN 2861.895656
26 Regional Municipality of Durham Municipal Municipality Pringle Creek WPCP Facilities related to the treatment of sewage 500 Victoria St. E. Whitby L1N 9Z3 NaN NaN ... NaN 0 NaN 0 NaN 188669.270325 1.866252 NaN NaN 518.403245
27 Regional Municipality of Durham Municipal Municipality Uxbridge Brook WPCP Facilities related to the treatment of sewage 127 Main St. N. Uxbridge L9P 1C6 NaN NaN ... NaN 0 NaN 0 NaN 173956.965696 5.476277 NaN NaN 1521.187979
28 Regional Municipality of Durham Municipal Municipality Nonquon River WPCP Facilities related to the treatment of sewage 1730 Scugog Line 8 Port Perry L9L 1B2 NaN NaN ... NaN 0 NaN 0 NaN 57057.221160 1.552262 NaN NaN 431.184028
29 Regional Municipality of Durham Municipal Municipality Ajax WSP Facilities related to the treatment of water 75 Lake Driveway E Ajax L1S 2Z9 NaN NaN ... NaN 0 NaN 0 NaN 1255807.263087 2.111772 NaN NaN 586.603279
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
18713 City of Waterloo Municipal Municipality RIM Park - Manulife Financial Sportsplex - Gyms Gyms and indoor courts for playing tennis, bas... 2001 University Avenue East Waterloo N2K 4K4 73059.00 Square feet ... NaN NaN NaN NaN NaN 413611.369124 NaN 42.473947 1.645923 NaN
18714 City of Waterloo Municipal Municipality RIM Park - Manulife Financial Sportsplex - Ice... Indoor ice rinks 2001 University Avenue East Waterloo N2K 4K4 94833.00 Square feet ... NaN NaN NaN NaN NaN 536881.246227 NaN 42.473947 1.645923 NaN
18715 City of Waterloo Municipal Municipality RIM Park - Manulife Financial Sportsplex - Off... Administrative offices and related facilities,... 2001 University Avenue East Waterloo N2K 4K4 30622.00 Square feet ... NaN NaN NaN NaN NaN 173361.356510 NaN 42.473947 1.645923 NaN
18716 City of Waterloo Municipal Municipality RIM Park - Manulife Financial Sportsplex - Rec... Indoor recreational facilities 2001 University Avenue East Waterloo N2K 4K4 121486.00 Square feet ... NaN NaN NaN NaN NaN 687772.769807 NaN 42.473947 1.645923 NaN
18717 City of Waterloo Municipal Municipality Rink In The Park: Community Centre Community centres 99 Seagram Drive Waterloo N2L 3B6 10069.00 Square feet ... NaN NaN NaN NaN NaN 45628.385062 NaN 33.499245 1.298141 NaN
18718 City of Waterloo Municipal Municipality Rink In The Park: Ice Rink Indoor ice rinks 99 Seagram Drive Waterloo N2L 3B6 23504.00 Square feet ... NaN NaN NaN NaN NaN 106510.036995 NaN 33.499245 1.298141 NaN
18719 City of Waterloo Municipal Municipality Service Centre - Main Building - Offices Administrative offices and related facilities,... 265 Lexington Court Waterloo N2J 4R9 16697.16 Square feet ... NaN NaN NaN NaN NaN 79792.663277 NaN 31.399535 1.216774 NaN
18720 City of Waterloo Municipal Municipality Service Centre - Main Building - Storage Storage facilities where equipment or vehicles... 265 Lexington Court Waterloo N2J 4R9 43194.84 Square feet ... NaN NaN NaN NaN NaN 206420.212984 NaN 31.399535 1.216774 NaN
18721 City of Waterloo Municipal Municipality Service Centre - Oktoberfest Building Storage facilities where equipment or vehicles... 265 Lexington Court Waterloo N2J 4R9 6000.00 Square feet ... NaN NaN NaN NaN NaN 5944.653064 NaN 10.105829 0.391614 NaN
18722 City of Waterloo Municipal Municipality Service Centre - Parks Portable Storage facilities where equipment or vehicles... 265 Lexington Court Waterloo N2J 4R9 1000.00 Square feet ... NaN NaN NaN NaN NaN 990.775511 NaN 10.105829 0.391614 NaN
18723 City of Waterloo Municipal Municipality Service Centre - Pigeon Coop/Cold Vehicle Stor... Storage facilities where equipment or vehicles... 265 Lexington Court Waterloo N2J 4R9 6000.00 Square feet ... NaN NaN NaN NaN NaN 5944.653064 NaN 10.105829 0.391614 NaN
18724 City of Waterloo Municipal Municipality Service Centre - Truckwash Storage facilities where equipment or vehicles... 265 Lexington Court Waterloo N2J 4R9 4000.00 Square feet ... NaN NaN NaN NaN NaN 16429.896481 NaN 27.625720 1.070534 NaN
18725 City of Waterloo Municipal Municipality Uptown Parkade (Willis Way) Parking garages 60 King Street Waterloo N2J 1N8 207084.00 Square feet ... NaN NaN NaN NaN NaN 94521.455262 NaN 3.714863 0.143956 NaN
18726 City of Waterloo Municipal Municipality Waterloo City Centre Administrative offices and related facilities,... 100 Regina Street South Waterloo N2J 4A8 75000.00 Square feet ... NaN NaN NaN NaN NaN 307870.211965 NaN 32.158291 1.246177 NaN
18727 City of Waterloo Municipal Municipality Waterloo Library (Main Branch) Public libraries 35 Albert Street Waterloo N2L 5E2 ‎ 35200.00 Square feet ... NaN NaN NaN NaN NaN 123753.494712 NaN 19.782686 0.766606 NaN
18728 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Facilities Indoor recreational facilities 101 Father David Bauer Drive Waterloo N2L 6L1 66168.00 Square feet ... NaN NaN NaN NaN NaN 428804.332943 NaN 46.022547 1.783436 NaN
18729 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Ice Rink Indoor ice rinks 101 Father David Bauer Drive Waterloo N2L 6L1 78306.00 Square feet ... NaN NaN NaN NaN NaN 507465.120533 NaN 46.022547 1.783436 NaN
18730 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Offices Administrative offices and related facilities,... 101 Father David Bauer Drive Waterloo N2L 6L1 3147.00 Square feet ... NaN NaN NaN NaN NaN 20394.257583 NaN 46.022547 1.783436 NaN
18731 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Portabl... Storage facilities where equipment or vehicles... 101 Father David Bauer Drive Waterloo N2L 6L1 1000.00 Square feet ... NaN NaN NaN NaN NaN 6480.539429 NaN 46.022547 1.783436 NaN
18732 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Portabl... Administrative offices and related facilities,... 101 Father David Bauer Drive Waterloo N2L 6L1 1000.00 Square feet ... NaN NaN NaN NaN NaN 6480.539429 NaN 46.022547 1.783436 NaN
18733 City of Waterloo Municipal Municipality Waterloo Memorial Recreation Complex - Swimmin... Indoor swimming pools 101 Father David Bauer Drive Waterloo N2L 6L1 34007.00 Square feet ... NaN NaN NaN NaN NaN 220383.704365 NaN 46.022547 1.783436 NaN
18734 City of Waterloo Municipal Municipality Waterloo Park - Eby Schoolhouse Cultural facilities Waterloo Park Waterloo N2L 430.00 Square feet ... NaN NaN NaN NaN NaN 1806.205858 NaN 25.573251 0.990998 NaN
18735 City of Waterloo Municipal Municipality Waterloo Park - Former Woodworkers Building Storage facilities where equipment or vehicles... Waterloo Park Waterloo N2L 1112.00 Square feet ... NaN NaN NaN NaN NaN 476.290678 NaN 4.368818 0.169298 NaN
18736 City of Waterloo Municipal Municipality Waterloo Park - Grist Mill Cultural facilities Waterloo Park Waterloo N2L 2080.00 Square feet ... NaN NaN NaN NaN NaN 8736.995776 NaN 25.573251 0.990998 NaN
18737 City of Waterloo Municipal Municipality Waterloo Park - Potters Workshop-Erb Farmhouse Cultural facilities Waterloo Park Waterloo N2L 2520.00 Square feet ... NaN NaN NaN NaN NaN 10585.206421 NaN 25.573251 0.990998 NaN
18738 City of Waterloo Municipal Municipality Waterloo Park - Pump House Facilities related to the pumping of water Waterloo Park Waterloo N2L 264.00 Square feet ... NaN NaN NaN NaN NaN 113.076204 4.152125 4.368818 0.169298 1153.368055
18739 City of Waterloo Municipal Municipality Waterloo Park - Service Centre: Offices Administrative offices and related facilities,... Waterloo Park Waterloo N2L 1619.00 Square feet ... NaN NaN NaN NaN NaN 693.448388 NaN 4.368818 0.169298 NaN
18740 City of Waterloo Municipal Municipality Waterloo Park - Service Centre: Storage Storage facilities where equipment or vehicles... Waterloo Park Waterloo N2L 1990.00 Square feet ... NaN NaN NaN NaN NaN 852.354720 NaN 4.368818 0.169298 NaN
18741 City of Waterloo Municipal Municipality Waterloo Park - Storage Booth Storage facilities where equipment or vehicles... Waterloo Park Waterloo N2L 240.00 Square feet ... NaN NaN NaN NaN NaN 102.796549 NaN 4.368818 0.169298 NaN
18742 City of Waterloo Municipal Municipality Waterloo St. Jacob Railway Station Cultural facilities 10 Father David Bauer Drive Waterloo N2L 6M3 2400.00 Square feet ... NaN NaN NaN NaN NaN 6449.269920 NaN 18.031342 0.698739 NaN

18743 rows × 41 columns


In [10]:
dfraw2011.head()


Out[10]:
Organization Name Sector Name SubSector Name Operation Name Operation Type Address City ZIP/Postal Code Total Floor Area Unit1 ... Unit10 Renewable2 Emission Factor2 Swimming Pool Number of Portables GHG Emissions(Kg) Energy Intensity (GJ/Mega Litres) Energy Intensity (ekWh/sqft) Energy Intensity (GJ/m2) Energy Intensity (ekWh/Mega Litres)
0 Town of Goderich Municipal Municipality Municipal Office Administrative offices and related facilities,... 57 West Street Goderich N7A 2K5 21510 Square feet ... NaN 0 NaN 0 NaN 24740.490790 NaN 11.650264 0.451463 NaN
1 Town of Goderich Municipal Municipality Goderich Library Public libraries 52 Montreal Street Goderich N7A 2K5 1100 Square meters ... NaN 0 NaN 0 NaN 45163.116457 NaN 25.237567 0.977989 NaN
2 Town of Goderich Municipal Municipality Water Treatment Plant Facilities related to the treatment of water 100 Cove Rd Goderich N7A 2K5 733 Square meters ... NaN 0 NaN 0 NaN 97528.525320 2.547766 126.078258 4.885701 707.712764
3 Town of Goderich Municipal Municipality Elevated Tank Facilities related to the pumping of water 220 St David Street Goderich N7A 2K5 63 Square meters ... NaN 0 NaN 0 NaN 1521.482760 55.868400 22.884372 0.886800 15519.000000
4 Town of Goderich Municipal Municipality Reservoir-Booster Pump Station Facilities related to the pumping of water 371 Parsons Court Goderich N7A 2K5 184 Square meters ... NaN 0 NaN 0 NaN 12154.214880 446.299196 62.592400 2.425539 123972.000000

5 rows × 41 columns


In [11]:
dfraw2011.head(5)


Out[11]:
Organization Name Sector Name SubSector Name Operation Name Operation Type Address City ZIP/Postal Code Total Floor Area Unit1 ... Unit10 Renewable2 Emission Factor2 Swimming Pool Number of Portables GHG Emissions(Kg) Energy Intensity (GJ/Mega Litres) Energy Intensity (ekWh/sqft) Energy Intensity (GJ/m2) Energy Intensity (ekWh/Mega Litres)
0 Town of Goderich Municipal Municipality Municipal Office Administrative offices and related facilities,... 57 West Street Goderich N7A 2K5 21510 Square feet ... NaN 0 NaN 0 NaN 24740.490790 NaN 11.650264 0.451463 NaN
1 Town of Goderich Municipal Municipality Goderich Library Public libraries 52 Montreal Street Goderich N7A 2K5 1100 Square meters ... NaN 0 NaN 0 NaN 45163.116457 NaN 25.237567 0.977989 NaN
2 Town of Goderich Municipal Municipality Water Treatment Plant Facilities related to the treatment of water 100 Cove Rd Goderich N7A 2K5 733 Square meters ... NaN 0 NaN 0 NaN 97528.525320 2.547766 126.078258 4.885701 707.712764
3 Town of Goderich Municipal Municipality Elevated Tank Facilities related to the pumping of water 220 St David Street Goderich N7A 2K5 63 Square meters ... NaN 0 NaN 0 NaN 1521.482760 55.868400 22.884372 0.886800 15519.000000
4 Town of Goderich Municipal Municipality Reservoir-Booster Pump Station Facilities related to the pumping of water 371 Parsons Court Goderich N7A 2K5 184 Square meters ... NaN 0 NaN 0 NaN 12154.214880 446.299196 62.592400 2.425539 123972.000000

5 rows × 41 columns


In [12]:
dfraw2011.head?

In [13]:
dfraw2011.tail()


Out[13]:
Organization Name Sector Name SubSector Name Operation Name Operation Type Address City ZIP/Postal Code Total Floor Area Unit1 ... Unit10 Renewable2 Emission Factor2 Swimming Pool Number of Portables GHG Emissions(Kg) Energy Intensity (GJ/Mega Litres) Energy Intensity (ekWh/sqft) Energy Intensity (GJ/m2) Energy Intensity (ekWh/Mega Litres)
18738 City of Waterloo Municipal Municipality Waterloo Park - Pump House Facilities related to the pumping of water Waterloo Park Waterloo N2L 264 Square feet ... NaN NaN NaN NaN NaN 113.076204 4.152125 4.368818 0.169298 1153.368055
18739 City of Waterloo Municipal Municipality Waterloo Park - Service Centre: Offices Administrative offices and related facilities,... Waterloo Park Waterloo N2L 1619 Square feet ... NaN NaN NaN NaN NaN 693.448388 NaN 4.368818 0.169298 NaN
18740 City of Waterloo Municipal Municipality Waterloo Park - Service Centre: Storage Storage facilities where equipment or vehicles... Waterloo Park Waterloo N2L 1990 Square feet ... NaN NaN NaN NaN NaN 852.354720 NaN 4.368818 0.169298 NaN
18741 City of Waterloo Municipal Municipality Waterloo Park - Storage Booth Storage facilities where equipment or vehicles... Waterloo Park Waterloo N2L 240 Square feet ... NaN NaN NaN NaN NaN 102.796549 NaN 4.368818 0.169298 NaN
18742 City of Waterloo Municipal Municipality Waterloo St. Jacob Railway Station Cultural facilities 10 Father David Bauer Drive Waterloo N2L 6M3 2400 Square feet ... NaN NaN NaN NaN NaN 6449.269920 NaN 18.031342 0.698739 NaN

5 rows × 41 columns


In [14]:
dfnor2012.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 16891 entries, 0 to 16890
Data columns (total 7 columns):
Organization Name             16891 non-null object
Sector Name                   16891 non-null object
Subsector Name                16891 non-null object
Operation Name                16891 non-null object
Address                       16891 non-null object
eWh/HDD/ft^2                  13894 non-null float64
Energy Intensity (ekWh/ML)    2997 non-null float64
dtypes: float64(2), object(5)
memory usage: 1.0+ MB

In [15]:
dfnor2011.dtypes


Out[15]:
Organization Name              object
Sector Name                    object
SubSector Name                 object
Operation Name                 object
Address                        object
eWh/HDD/ft^2                  float64
Energy Intensity (ekWh/ML)    float64
dtype: object

In [16]:
dfnor2011['Sector Name'].head(5)


Out[16]:
0    Public Hospital
1    Public Hospital
2    Public Hospital
3    Public Hospital
4       School Board
Name: Sector Name, dtype: object

In [17]:
dfnor2011['Sector Name'][0:5]


Out[17]:
0    Public Hospital
1    Public Hospital
2    Public Hospital
3    Public Hospital
4       School Board
Name: Sector Name, dtype: object

In [18]:
dfnor2011['Sector Name'][-1:]


Out[18]:
15607    Post-Secondary Educational Institution
Name: Sector Name, dtype: object

In [19]:
dfnor2011['Sector Name'][-3:-1]#[-3:]


Out[19]:
15605    Post-Secondary Educational Institution
15606    Post-Secondary Educational Institution
Name: Sector Name, dtype: object

In [20]:
dfnor2011[['Sector Name', 'SubSector Name']].head()


Out[20]:
Sector Name SubSector Name
0 Public Hospital Acute/Chronic
1 Public Hospital Acute/Chronic
2 Public Hospital Acute/Chronic
3 Public Hospital Acute/Chronic
4 School Board School Board

In [21]:
dfnor2011[['Sector Name', 'SubSector Name']].iloc[1:3,:]


Out[21]:
Sector Name SubSector Name
1 Public Hospital Acute/Chronic
2 Public Hospital Acute/Chronic

In [22]:
dfnor2011['Sector Name'].unique()


Out[22]:
array([u'Public Hospital', u'School Board',
       u'Post-Secondary Educational Institution', u'Municipal'], dtype=object)

In [23]:
dfnor2011['Sector Name'].value_counts()#.plot(kind = 'bar')


Out[23]:
Municipal                                 8585
School Board                              4846
Post-Secondary Educational Institution    1724
Public Hospital                            453
dtype: int64

In [24]:
dfnor2011['eWh/HDD/ft^2'].value_counts()


Out[24]:
8.212789     103
3.151094      64
23.044362     44
3.151094      39
2.601869      37
3.151094      28
2.560223      26
16.553547     18
17.101817     18
8.212789      18
18.259094     18
6.781326      17
2.837007      17
2.720220      16
5.654048      16
8.212789      15
2.548403      14
3.021377      14
27.768012     12
3.021377      12
18.259094     12
2.305031      10
2.837007      10
2.113985      10
3.816552       9
7.394174       9
23.044362      9
2.548403       9
25.000218      9
7.394174       8
            ... 
7.348340       1
5.996286       1
2.888320       1
5.979118       1
5.559013       1
4.523632       1
3.728700       1
9.471451       1
5.056463       1
5.202316       1
6.555126       1
1.754433       1
6.131317       1
8.963621       1
7.614708       1
8.138290       1
6.522670       1
5.523306       1
4.168972       1
3.916862       1
5.642158       1
4.394589       1
4.442611       1
11.217763      1
3.304116       1
4.593407       1
7.987551       1
5.774591       1
10.920013      1
4.019896       1
dtype: int64

In [25]:
dfnor2011['eWh/HDD/ft^2'].sum()


Out[25]:
97473.236574964758

In [26]:
dfnor2011['eWh/HDD/ft^2'].max()


Out[26]:
30.09718755521147

In [27]:
dfnor2011['eWh/HDD/ft^2'].min()


Out[27]:
1.0135549167298097

In [28]:
dfnor2011['eWh/HDD/ft^2'].median()


Out[28]:
5.709007444115958

In [29]:
dfnor2011['eWh/HDD/ft^2'].describe()


Out[29]:
count    13843.000000
mean         7.041338
std          4.368176
min          1.013555
25%          4.129404
50%          5.709007
75%          8.395510
max         30.097188
Name: eWh/HDD/ft^2, dtype: float64

In [30]:
dfnor2011.describe()


Out[30]:
eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
count 13843.000000 1765.000000
mean 7.041338 739739.389415
std 4.368176 1335182.997109
min 1.013555 25455.284553
25% 4.129404 156891.601383
50% 5.709007 373978.394495
75% 8.395510 853031.580468
max 30.097188 30882353.318081

In [31]:
dfnor2011.describe(include = ['object'])


Out[31]:
Organization Name Sector Name SubSector Name Operation Name Address
count 15608 15608 15608 15608 14529
unique 670 4 8 12671 11593
top Toronto District School Board Municipal Municipality Municipal Office 1001 Fanshawe College Blvd
freq 582 8585 8517 56 113

In [32]:
dfnor2011.describe(include = ['number'])


Out[32]:
eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
count 13843.000000 1765.000000
mean 7.041338 739739.389415
std 4.368176 1335182.997109
min 1.013555 25455.284553
25% 4.129404 156891.601383
50% 5.709007 373978.394495
75% 8.395510 853031.580468
max 30.097188 30882353.318081

In [33]:
dfnor2011.describe(include = 'all')


Out[33]:
Organization Name Sector Name SubSector Name Operation Name Address eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
count 15608 15608 15608 15608 14529 13843.000000 1765.000000
unique 670 4 8 12671 11593 NaN NaN
top Toronto District School Board Municipal Municipality Municipal Office 1001 Fanshawe College Blvd NaN NaN
freq 582 8585 8517 56 113 NaN NaN
mean NaN NaN NaN NaN NaN 7.041338 739739.389415
std NaN NaN NaN NaN NaN 4.368176 1335182.997109
min NaN NaN NaN NaN NaN 1.013555 25455.284553
25% NaN NaN NaN NaN NaN 4.129404 156891.601383
50% NaN NaN NaN NaN NaN 5.709007 373978.394495
75% NaN NaN NaN NaN NaN 8.395510 853031.580468
max NaN NaN NaN NaN NaN 30.097188 30882353.318081

In [35]:
dfraw2011['SubSector Name'].value_counts()#.plot(kind = 'bar')


Out[35]:
Municipality               11999
School Board                4984
College                      878
Acute/Chronic                411
University                   270
Municipal Service Board      108
Acute                         59
Chronic                       34
dtype: int64

In [36]:
1 == 0
1 > 0
1< 0


Out[36]:
False

In [37]:
dfraw2011['Sector Name']=='Public Hospital'


Out[37]:
0        False
1        False
2        False
3        False
4        False
5        False
6        False
7        False
8        False
9        False
10       False
11       False
12       False
13       False
14       False
15       False
16       False
17        True
18        True
19       False
20       False
21       False
22       False
23       False
24       False
25       False
26       False
27       False
28       False
29       False
         ...  
18713    False
18714    False
18715    False
18716    False
18717    False
18718    False
18719    False
18720    False
18721    False
18722    False
18723    False
18724    False
18725    False
18726    False
18727    False
18728    False
18729    False
18730    False
18731    False
18732    False
18733    False
18734    False
18735    False
18736    False
18737    False
18738    False
18739    False
18740    False
18741    False
18742    False
Name: Sector Name, dtype: bool

In [38]:
dfraw2011[dfraw2011['Sector Name']=='Public Hospital']['Sector Name']


Out[38]:
17       Public Hospital
18       Public Hospital
834      Public Hospital
868      Public Hospital
869      Public Hospital
870      Public Hospital
871      Public Hospital
918      Public Hospital
919      Public Hospital
920      Public Hospital
933      Public Hospital
934      Public Hospital
935      Public Hospital
936      Public Hospital
937      Public Hospital
938      Public Hospital
939      Public Hospital
947      Public Hospital
948      Public Hospital
949      Public Hospital
950      Public Hospital
951      Public Hospital
952      Public Hospital
953      Public Hospital
954      Public Hospital
955      Public Hospital
956      Public Hospital
957      Public Hospital
1081     Public Hospital
1170     Public Hospital
              ...       
17961    Public Hospital
18009    Public Hospital
18010    Public Hospital
18011    Public Hospital
18070    Public Hospital
18307    Public Hospital
18503    Public Hospital
18504    Public Hospital
18505    Public Hospital
18506    Public Hospital
18507    Public Hospital
18508    Public Hospital
18509    Public Hospital
18510    Public Hospital
18511    Public Hospital
18555    Public Hospital
18556    Public Hospital
18576    Public Hospital
18577    Public Hospital
18578    Public Hospital
18579    Public Hospital
18580    Public Hospital
18581    Public Hospital
18582    Public Hospital
18583    Public Hospital
18584    Public Hospital
18585    Public Hospital
18586    Public Hospital
18587    Public Hospital
18588    Public Hospital
Name: Sector Name, dtype: object

In [39]:
dfraw2011[dfraw2011['Sector Name']=='Public Hospital']['Sector Name'].value_counts()


Out[39]:
Public Hospital    504
dtype: int64

In [40]:
dfraw2011[dfraw2011['Sector Name']=='Public Hospital']['SubSector Name'].value_counts()


Out[40]:
Acute/Chronic    411
Acute             59
Chronic           34
dtype: int64

In [41]:
dfnor2011[dfnor2011['eWh/HDD/ft^2'] == dfnor2011['eWh/HDD/ft^2'].max()]


Out[41]:
Organization Name Sector Name SubSector Name Operation Name Address eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
11053 Toronto East General Hospital Public Hospital Acute/Chronic Toronto East General Hospital 825 Coxwell Avenue 30.097188 NaN

In [43]:
dfnor2011[dfnor2011['eWh/HDD/ft^2'] > dfnor2011['eWh/HDD/ft^2'].median()]


Out[43]:
Organization Name Sector Name SubSector Name Operation Name Address eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
0 Alexandra Hospital Public Hospital Acute/Chronic Alexandra Hospital 29 Noxon Street 19.541729 NaN
1 Alexandra Hospital Public Hospital Acute/Chronic Alexandra Hospital 29 Noxon Street 19.541729 NaN
2 Alexandria Glengarry Memorial Hospital Public Hospital Acute/Chronic Glengarry Memorial Hospital 20260 County Road 43 18.506644 NaN
3 Alexandria Glengarry Memorial Hospital Public Hospital Acute/Chronic Glengarry Memorial Hospital 20260 County Road 43 18.506758 NaN
4 Algoma District School Board School Board School Board Education Centre 644 Albert St. E. 6.682623 NaN
5 Algoma District School Board School Board School Board Central Plant Office 190 Northern Ave. E. 6.966865 NaN
46 Algoma District School Board School Board School Board Echo Bay Central PS 290 Church St 5.822250 NaN
47 Algoma District School Board School Board School Board Francis H Clergue PS 80 Weldon Ave 6.177988 NaN
48 Algoma District School Board School Board School Board Grandview PS 161 Denwood Dr 6.177988 NaN
49 Algoma District School Board School Board School Board Rockhaven TR School 1859 Riverview Road 6.177988 NaN
50 Algoma District School Board School Board School Board Superior Heights C&VS & Interm. School 750 North St 6.177988 NaN
51 Algoma District School Board School Board School Board Central Algoma SS 32 Kensington Rd 6.177988 NaN
52 Algoma District School Board School Board School Board Laird Central PS 349 Lake George Rd 6.177988 NaN
53 Algoma District School Board School Board School Board Wm Merrifield VC PS 331 Patrick St 6.177988 NaN
55 Algoma University Post-Secondary Educational Institution University Algoma University 1520 Queen Street East 7.365207 NaN
57 Algoma University Post-Secondary Educational Institution University Algoma University 1520 Queen Street East 7.365207 NaN
58 Algonquin & Lakeshore Catholic District School... School Board School Board Plant Operations (East) 131 Grant Timmons Drive 5.712772 NaN
59 Algonquin & Lakeshore Catholic District School... School Board School Board ALCDSB Catholic Education Centre 151 Dairy Ave 8.705246 NaN
78 Algonquin & Lakeshore Catholic District School... School Board School Board St Peter Catholic School (Kingston) 48 Seventh Ave 5.719950 NaN
79 Algonquin & Lakeshore Catholic District School... School Board School Board J J O'Neill Catholic School 240 Marilyn Ave 5.820281 NaN
80 Algonquin & Lakeshore Catholic District School... School Board School Board Nicholson Catholic College 301 Church Street 5.938491 NaN
81 Algonquin & Lakeshore Catholic District School... School Board School Board Regiopolis - Notre Dame Catholic Secondary School 130 Russell St 5.976448 NaN
82 Algonquin & Lakeshore Catholic District School... School Board School Board St Marguerite Bourgeois Catholic School 355 Waterloo Drive 6.021760 NaN
83 Algonquin & Lakeshore Catholic District School... School Board School Board Sacred Heart Catholic School (Batawa) 31 Thomas Bata Blvd., P.O. Box 135 6.100150 NaN
84 Algonquin & Lakeshore Catholic District School... School Board School Board Our Lady of Mercy Catholic School 192 Bridge Street, West, P.O. Box 778 6.781326 NaN
85 Algonquin & Lakeshore Catholic District School... School Board School Board St Paul Catholic School (Kingston) 266 McMahon Ave 6.684034 NaN
86 Algonquin & Lakeshore Catholic District School... School Board School Board Holy Family Catholic School 114 Wiley St 6.780222 NaN
87 Algonquin & Lakeshore Catholic District School... School Board School Board Mother Teresa Catholic School 1044 Lancaster Dr 6.831611 NaN
88 Algonquin & Lakeshore Catholic District School... School Board School Board Sacred Heart Catholic School (Wolfe Island) 57 Road 95, Box 59 6.910730 NaN
89 Algonquin & Lakeshore Catholic District School... School Board School Board St Mary Catholic School (Read) 1285 Read Side Road, RR 1 7.081176 NaN
... ... ... ... ... ... ... ...
15578 York University Post-Secondary Educational Institution University Calumet Residence (390) 4700 Keele Street 8.151098 NaN
15579 York University Post-Secondary Educational Institution University Vanier Residence (371) 4700 Keele Street 8.335116 NaN
15580 York University Post-Secondary Educational Institution University Atkinson Residence (365) 4700 Keele Street 8.377207 NaN
15581 York University Post-Secondary Educational Institution University Student Centre (388) 4700 Keele Street 8.695928 NaN
15582 York University Post-Secondary Educational Institution University Tait McKenzie Physical Education Centre (361)(... 4700 Keele Street 8.972517 NaN
15583 York University Post-Secondary Educational Institution University Curtis Lecture Halls (380) 4700 Keele Street 9.396731 NaN
15584 York University Post-Secondary Educational Institution University Ignat Kaneff Building - Osgoode (384) 4700 Keele Street 9.957537 NaN
15585 York University Post-Secondary Educational Institution University Norman Bethune Residence (410) 4700 Keele Street 10.028195 NaN
15586 York University Post-Secondary Educational Institution University Gatehouse (Cottage) (322) 2275 Bayview Avenue 10.044881 NaN
15587 York University Post-Secondary Educational Institution University Founders Residence (359) 4700 Keele Street 10.139537 NaN
15588 York University Post-Secondary Educational Institution University Wood Residence (308) 2275 Bayview Avenue 10.430258 NaN
15589 York University Post-Secondary Educational Institution University 380 Assiniboine Road (402) 4700 Keele Street 10.495021 NaN
15590 York University Post-Secondary Educational Institution University Hilliard Residence (321) 2275 Bayview Avenue 10.836191 NaN
15591 York University Post-Secondary Educational Institution University Joan and Martin Goldfarb Centre for Fine Arts ... 4700 Keele Street 11.073830 NaN
15592 York University Post-Secondary Educational Institution University 320 Assiniboine Road (403) 4700 Keele Street 11.222557 NaN
15593 York University Post-Secondary Educational Institution University Stong Residence (389) 4700 Keele Street 11.546006 NaN
15594 York University Post-Secondary Educational Institution University 360 Assiniboine Road (401) 4700 Keele Street 11.571018 NaN
15595 York University Post-Secondary Educational Institution University Sherman Health Science Research Centre (441) 4700 Keele Street 11.703107 NaN
15596 York University Post-Secondary Educational Institution University McLaughlin College (378) 4700 Keele Street 11.728631 NaN
15597 York University Post-Secondary Educational Institution University Petrie Science and Engineering Building (373) 4700 Keele Street 11.750054 NaN
15598 York University Post-Secondary Educational Institution University 340 Assiniboine Road (400) 4700 Keele Street 11.926388 NaN
15599 York University Post-Secondary Educational Institution University Vanier College (353) 4700 Keele Street 12.205868 NaN
15600 York University Post-Secondary Educational Institution University Vari Hall (381) 4700 Keele Street 12.353858 NaN
15601 York University Post-Secondary Educational Institution University Winters Residence (374) 4700 Keele Street 12.822218 NaN
15602 York University Post-Secondary Educational Institution University Tatham Hall (379) 4700 Keele Street 13.083783 NaN
15603 York University Post-Secondary Educational Institution University Proctor Field House (309) 2275 Bayview Avenue 16.038605 NaN
15604 York University Post-Secondary Educational Institution University Centre for Film and Theatre (399) 4700 Keele Street 18.301718 NaN
15605 York University Post-Secondary Educational Institution University Leonard G. Lumbers Building (366) 4700 Keele Street 18.436669 NaN
15606 York University Post-Secondary Educational Institution University Stedman Lecture Halls (362) 4700 Keele Street 19.712420 NaN
15607 York University Post-Secondary Educational Institution University Chemistry Building (367) 4700 Keele Street 22.391031 NaN

6921 rows × 7 columns


In [44]:
dfnor2011_copy = dfnor2011.copy()

In [45]:
dfnor2011 = dfnor2011.drop_duplicates()

In [46]:
dfnor2011[dfnor2011['eWh/HDD/ft^2'] > dfnor2011['eWh/HDD/ft^2'].median()].count()


Out[46]:
Organization Name             6542
Sector Name                   6542
SubSector Name                6542
Operation Name                6542
Address                       5955
eWh/HDD/ft^2                  6542
Energy Intensity (ekWh/ML)       0
dtype: int64

In [47]:
dfnor2011['eWh/HDD/ft^2'].describe()


Out[47]:
count    13084.000000
mean         6.960245
std          4.387946
min          1.013555
25%          4.074590
50%          5.611060
75%          8.212789
max         30.097188
Name: eWh/HDD/ft^2, dtype: float64

In [48]:
dfnor2011[(dfnor2011['eWh/HDD/ft^2'] > 5.6) & (dfnor2011['eWh/HDD/ft^2'] < 8.2)].describe()


Out[48]:
eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
count 3201.000000 0
mean 6.707063 NaN
std 0.738472 NaN
min 5.600989 NaN
25% 6.060738 NaN
50% 6.624349 NaN
75% 7.289876 NaN
max 8.199451 NaN

In [360]:
dfnor2011['SubSector Name'].value_counts()


Out[360]:
Municipality               8423
School Board               4845
College                     785
Acute/Chronic               360
University                  277
Municipal Service Board      68
Acute                        57
Chronic                      34
dtype: int64

In [49]:
subsector311n = dfnor2011[dfnor2011['SubSector Name'].isin(['School Board', 'College', 'University'])]

In [50]:
subsector311n['SubSector Name'].value_counts()


Out[50]:
School Board    4845
College          785
University       277
dtype: int64

In [51]:
dfnor2011[dfnor2011['SubSector Name'].str.contains('Acute')]['SubSector Name'].value_counts()


Out[51]:
Acute/Chronic    360
Acute             57
dtype: int64

In [52]:
dfnor2011['eWh/HDD/ft^2'][:10]


Out[52]:
0     19.541729
2     18.506644
3     18.506758
4      6.682623
5      6.966865
6      2.370379
7      2.941017
8      3.022181
9      3.052135
10     3.080804
Name: eWh/HDD/ft^2, dtype: float64

In [53]:
dfnor2011['eWh/HDD/ft^2'].order()[:10]


Out[53]:
180      1.013555
181      1.013555
14164    1.376300
14227    1.446905
12851    1.450870
1094     1.450870
13458    1.534695
7294     1.535195
13650    1.573434
13457    1.574374
Name: eWh/HDD/ft^2, dtype: float64

In [54]:
dfnor2011['eWh/HDD/ft^2'].order(ascending = False)[:5]


Out[54]:
11053    30.097188
7641     30.097188
9692     30.097188
7640     30.097188
11113    30.097188
Name: eWh/HDD/ft^2, dtype: float64

In [55]:
dfnor2011.sort_index(by = ['SubSector Name','eWh/HDD/ft^2'])[:5]


Out[55]:
Organization Name Sector Name SubSector Name Operation Name Address eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
5903 Hornepayne Community Hospital Public Hospital Acute Hornepayne Community Hospital 270 Front Street 1.916606 NaN
5904 Hornepayne Community Hospital Public Hospital Acute Hornepayne Community Hospital 272 Front Street 2.192223 NaN
8004 Ottawa Children's Hospital of Eastern Ontario Public Hospital Acute Children Hospital Of Eastern Ontario 401 Smyth Road 2.494761 NaN
5829 Hanover and District Hospital Public Hospital Acute Hanover and District Hospital 90 7th Ave 2.666608 NaN
11117 Toronto's Woman's College Hospital Public Hospital Acute Women's College Hospital 76 Greville St. 2.666608 NaN

In [56]:
dfnor2011.sort_index(by = ['SubSector Name','eWh/HDD/ft^2'], ascending = [0, 1])[:5]


Out[56]:
Organization Name Sector Name SubSector Name Operation Name Address eWh/HDD/ft^2 Energy Intensity (ekWh/ML)
14464 University of Ottawa Post-Secondary Educational Institution University Brooks Parking 100 Thomas More 2.104224 NaN
15527 York University Post-Secondary Educational Institution University Arboretum Lane Parking Garage - PSII (395) 4700 Keele Street 2.548403 NaN
6297 Laurentian University Post-Secondary Educational Institution University Laurentian University 935 Ramsey Lake Road 2.627483 NaN
14540 University of Western Ontario Post-Secondary Educational Institution University TD Waterhouse Stadium 100 Phillip Aziz 2.832039 NaN
14541 University of Western Ontario Post-Secondary Educational Institution University Westminster Site 367 367 Windermere Rd 3.047136 NaN

In [57]:
dfnor2011['Energy Intensity (ekWh/ML)'].isnull().sum()


Out[57]:
13084

In [58]:
dfnor2011['eWh/HDD/ft^2'].isnull().sum()


Out[58]:
1765

In [59]:
dfnor2011_copy['Energy Intensity (ekWh/ML)'] = dfnor2011_copy['Energy Intensity (ekWh/ML)'].fillna('why?')

In [60]:
dfnor2011['Energy Intensity (ekWh/ML)'].describe()


Out[60]:
count        1765.000000
mean       739739.389415
std       1335182.997109
min         25455.284553
25%        156891.601383
50%        373978.394495
75%        853031.580468
max      30882353.318081
Name: Energy Intensity (ekWh/ML), dtype: float64

In [61]:
dfnor2011['year'] = 2011

In [65]:
dfnor2012['year'] = 2012

In [66]:
dfnor2011.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 14849 entries, 0 to 15607
Data columns (total 8 columns):
Organization Name             14849 non-null object
Sector Name                   14849 non-null object
SubSector Name                14849 non-null object
Operation Name                14849 non-null object
Address                       13783 non-null object
eWh/HDD/ft^2                  13084 non-null float64
Energy Intensity (ekWh/ML)    1765 non-null float64
year                          14849 non-null int64
dtypes: float64(2), int64(1), object(5)
memory usage: 1.0+ MB

In [67]:
dfnor2012.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 16891 entries, 0 to 16890
Data columns (total 8 columns):
Organization Name             16891 non-null object
Sector Name                   16891 non-null object
Subsector Name                16891 non-null object
Operation Name                16891 non-null object
Address                       16891 non-null object
eWh/HDD/ft^2                  13894 non-null float64
Energy Intensity (ekWh/ML)    2997 non-null float64
year                          16891 non-null int64
dtypes: float64(2), int64(1), object(5)
memory usage: 1.2+ MB

In [68]:
set(list(dfnor2011.columns.values)) - set(list(dfnor2012.columns.values))


Out[68]:
{u'SubSector Name'}

In [69]:
dfnor2012 = dfnor2012.rename(columns = {'Subsector Name': 'SubSector Name'})

In [70]:
dfnor2012['new column'] = 0

In [71]:
dfnor2012['new column'].describe()


Out[71]:
count    16891
mean         0
std          0
min          0
25%          0
50%          0
75%          0
max          0
Name: new column, dtype: float64

In [72]:
dfnor2012 = dfnor2012.drop('new column', 1)

In [74]:
dfnor2012 = dfnor2012.drop_duplicates()

In [73]:
dfnor2012.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 16891 entries, 0 to 16890
Data columns (total 8 columns):
Organization Name             16891 non-null object
Sector Name                   16891 non-null object
SubSector Name                16891 non-null object
Operation Name                16891 non-null object
Address                       16891 non-null object
eWh/HDD/ft^2                  13894 non-null float64
Energy Intensity (ekWh/ML)    2997 non-null float64
year                          16891 non-null int64
dtypes: float64(2), int64(1), object(5)
memory usage: 1.2+ MB

In [75]:
merged = dfnor2011.merge(dfnor2012, how = 'outer')

In [76]:
merged.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 30601 entries, 0 to 30600
Data columns (total 8 columns):
Organization Name             30601 non-null object
Sector Name                   30601 non-null object
SubSector Name                30601 non-null object
Operation Name                30601 non-null object
Address                       29535 non-null object
eWh/HDD/ft^2                  25845 non-null float64
Energy Intensity (ekWh/ML)    4756 non-null float64
year                          30601 non-null float64
dtypes: float64(3), object(5)
memory usage: 2.1+ MB

In [77]:
dfnor2011.info()


<class 'pandas.core.frame.DataFrame'>
Int64Index: 14849 entries, 0 to 15607
Data columns (total 8 columns):
Organization Name             14849 non-null object
Sector Name                   14849 non-null object
SubSector Name                14849 non-null object
Operation Name                14849 non-null object
Address                       13783 non-null object
eWh/HDD/ft^2                  13084 non-null float64
Energy Intensity (ekWh/ML)    1765 non-null float64
year                          14849 non-null int64
dtypes: float64(2), int64(1), object(5)
memory usage: 1.0+ MB

In [78]:
merged.to_csv('mergednorm1112.csv', encoding = 'utf-8')

In [79]:
ls


LTEP_2013_English_WEB.pdf              energydescription.txt
ONenergy/                              mars data book club.pdf
ONenergy.ipynb                         mars data book club.pptx
ONenergy.py                            mergednorm1112.csv
ONenergy.zip                           questions
bps_energy_consumption_2011_2012.xlsx

In [229]:
dfraw2011['Unit1'].value_counts()


Out[229]:
Square feet      6518
Square Feet      4574
Square meters    4173
square feet       265
pieds carrés       52
Pieds carrés       47
square meters       5
Square Meters       2
Sq Ft               1
x                   1
dtype: int64

In [80]:
unit1convert = {'Square feet':'sqft', 'Square Feet':'sqft', 'square feet':'sqft', 'pieds carrés':'sqft', 'Pieds carrés':'sqft','Sq Ft':'sqft', 'x':'sqft','Square meters':'sqm', 'square meters':'sqm', 'Square Meters': 'sqm'}

In [81]:
dfraw2011['Unit1'] = dfraw2011['Unit1'].map(unit1convert)

In [82]:
dfraw2011['Unit1'].value_counts()


Out[82]:
sqft    11359
sqm      4180
dtype: int64