{"cells":[{"metadata":{"id":"vOvX5lCiRz9G","trusted":true},"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\n%matplotlib inline\nimport matplotlib.pyplot as plt\nimport re\nimport json\nimport seaborn as sns\nimport warnings\nwarnings.filterwarnings(\"ignore\")\nfrom glob import glob\nimport re \nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots\nimport gc\nimport geopandas\nfrom shapely import wkt","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"\"\"\"\nCITY DATA\n\"\"\"\nFull_Cities_Dataset = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Responses/2018_Full_Cities_Dataset.csv'),\n                                 pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Responses/2019_Full_Cities_Dataset.csv'),\n                                 pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Responses/2020_Full_Cities_Dataset.csv')\n                                 ])\nCities_Disclosing_to_CDP = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Disclosing/2020_Cities_Disclosing_to_CDP.csv'),\n                                      pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Disclosing/2019_Cities_Disclosing_to_CDP.csv'),\n                                      pd.read_csv('../input/cdp-unlocking-climate-solutions/Cities/Cities Disclosing/2018_Cities_Disclosing_to_CDP.csv')\n                                      ])\n\ncities_data = pd.merge(Full_Cities_Dataset[['Account Number','Parent Section', 'Section',\n                       'Question Number', 'Question Name', 'Column Number', 'Column Name', \n                       'Row Number', 'Row Name', 'Response Answer', 'Comments']],\n                       Cities_Disclosing_to_CDP[Cities_Disclosing_to_CDP['Account Number'].isin(Full_Cities_Dataset['Account Number'])],\n                       on='Account Number',\n                       how='left'\n                       )\n\"\"\"\nCORPORATION DATA\n\"\"\"\nCorporates_Disclosing_to_CDP_Water_Security = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Water Security/2020_Corporates_Disclosing_to_CDP_Water_Security.csv'), \n                                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Water Security/2019_Corporates_Disclosing_to_CDP_Water_Security.csv'),\n                                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Water Security/2018_Corporates_Disclosing_to_CDP_Water_Security.csv')\n                                                         ])\nCorporates_Disclosing_to_CDP_Climate_Change = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Climate Change/2018_Corporates_Disclosing_to_CDP_Climate_Change.csv'),\n                                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Climate Change/2019_Corporates_Disclosing_to_CDP_Climate_Change.csv'),\n                                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Disclosing/Climate Change/2020_Corporates_Disclosing_to_CDP_Climate_Change.csv')\n                                                         ])\n\nFull_Water_Security_Dataset = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Water Security/2019_Full_Water_Security_Dataset.csv'),\n                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Water Security/2018_Full_Water_Security_Dataset.csv'),\n                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Water Security/2020_Full_Water_Security_Dataset.csv')\n                                         ])\n\nFull_Climate_Change_Dataset = pd.concat([pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Climate Change/2019_Full_Climate_Change_Dataset.csv'),\n                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Climate Change/2018_Full_Climate_Change_Dataset.csv'),\n                                         pd.read_csv('../input/cdp-unlocking-climate-solutions/Corporations/Corporations Responses/Climate Change/2020_Full_Climate_Change_Dataset.csv',)\n                                         ])\n\nCorporates_Disclosing_to_CDP = pd.concat([Corporates_Disclosing_to_CDP_Climate_Change,\n                                          Corporates_Disclosing_to_CDP_Water_Security[~Corporates_Disclosing_to_CDP_Water_Security.account_number.isin(Corporates_Disclosing_to_CDP_Climate_Change.account_number)]\n                                          ])\n\nCorporates_Climate_Water_Dataset = pd.concat([Full_Climate_Change_Dataset,\n                                              Full_Water_Security_Dataset\n                                ])\n\"\"\"\nSUPPLEMENTARY DATA\n\"\"\"\nSocial_Vulnerability_Index_2018_county =  pd.read_csv('../input/cdp-unlocking-climate-solutions/Supplementary Data/CDC Social Vulnerability Index 2018/SVI2018_US_COUNTY.csv',)\nsvi = pd.read_csv('../input/cdp-unlocking-climate-solutions/Supplementary Data/CDC Social Vulnerability Index 2018/SVI2018_US.csv', usecols=['STATE', 'COUNTY', 'AREA_SQMI', \n                                       'E_TOTPOP', 'EP_POV', 'EP_UNEMP', 'EP_PCI', 'EP_NOHSDP', 'EP_MINRTY', 'EP_AGE65', 'EP_AGE17', \n                          'EP_DISABL', 'EP_SNGPNT', 'EP_LIMENG', 'EP_MUNIT', 'EP_MOBILE', 'EP_CROWD', 'EP_NOVEH', 'EP_GROUPQ', 'RPL_THEMES'])\nCities_Census = pd.read_csv('../input/cdp-unlocking-climate-solutions/Supplementary Data/CDC 500 Cities Census Tract Data/500_Cities__Census_Tract-level_Data__GIS_Friendly_Format___2019_release.csv',)\nUS_cities_map = pd.read_csv('../input/cdp-unlocking-climate-solutions/Supplementary Data/Simple Maps US Cities Data/uscities.csv',usecols=['city', 'state_name', 'county_fips', 'county_name', 'lat', 'lng', 'population', 'density', 'source', 'military', 'incorporated', 'ranking'])\nLocations = pd.read_csv('../input/cdp-unlocking-climate-solutions/Supplementary Data/Locations of Corporations/NA_HQ_public_data.csv')\nLocations.drop(columns={'address_lat', 'adress_long', 'survey_name'}, inplace=True)\nus_state_abbrev = {\n    'AB':'ALBERTA',\n    'AL':'Alabama',\n    'AK':'Alaska',\n    'AS':'American Samoa',\n    'AZ':'Arizona',\n    'AR':'Arkansas',\n    'CA':'California',\n    'CO':'Colorado',\n    'CT':'Connecticut',\n    'DE':'Delaware',\n    'DC':'District of Columbia',\n    'FL':'Florida',\n    'GA':'Georgia',\n    'GU':'Guam',\n    'HI':'Hawaii',\n    'ID':'Idaho',\n    'IL':'Illinois',\n    'IN':'Indiana',\n    'IA':'Iowa',\n    'KS':'Kansas',\n    'KY':'Kentucky',\n    'LA':'Louisiana',\n    'ME':'Maine',\n    'MD':'Maryland',\n    'MA':'Massachusetts',\n    'MI':'Michigan',\n    'MN':'Minnesota',\n    'MS':'Mississippi',\n    'MO':'Missouri',\n    'MT':'Montana',\n    'NE':'Nebraska',\n    'NV':'Nevada',\n    'NV':'New Hampshire',\n    'NV':'New Jersey',\n    'NM':'New Mexico',\n    'NY':'New York',\n    'NC':'North Carolina',\n    'ND':'North Dakota',\n    'MP':'Northern Mariana Islands',\n    'OH':'Ohio',\n    'OK':'Oklahoma',\n    'OR':'Oregon',\n    'PA':'Pennsylvania',\n    'PR':'Puerto Rico',\n    'RI':'Rhode Island',\n    'SC':'South Carolina',\n    'SD':'South Dakota',\n    'TN':'Tennessee',\n    'TX':'Texas',\n    'UT':'Utah',\n    'VT':'Vermont',\n    'VI':'Virgin Islands',\n    'VA':'Virginia',\n    'WA':'Washington',\n    'WV':'West Virginia',\n    'WI':'Wisconsin',\n    'WY':'Wyoming'\n}\n\nCities_Census['StateAbbr'] = Cities_Census['StateAbbr'].map(us_state_abbrev)\n\ncities_data = cities_data[~cities_data['Response Answer'].isnull()]\n\nsvi_unique = pd.DataFrame([svi[svi.STATE==x].values[0] for x in svi.STATE.unique()], columns=svi.columns)[['STATE']]\nsvi_state = svi[['STATE', 'AREA_SQMI', 'E_TOTPOP', 'EP_POV', 'EP_UNEMP', 'EP_PCI', 'EP_NOHSDP', 'EP_MINRTY', 'EP_AGE65', 'EP_AGE17', \n                       'EP_DISABL', 'EP_SNGPNT', 'EP_LIMENG', 'EP_MUNIT', 'EP_MOBILE', 'EP_CROWD', 'EP_NOVEH', 'EP_GROUPQ', \n                       'RPL_THEMES']].groupby('STATE').agg('sum')                                                      \nsvi_state = pd.merge(svi_state, svi_unique, on='STATE', how='left')\nsvi_state.STATE = svi_state.STATE.str.capitalize()\n\ncensus_df = pd.merge(Cities_Census, US_cities_map, left_on=['StateAbbr','PlaceName'], right_on=['state_name','city'], how='left')\ncensus_df.rename(columns={'PlaceFIPS':'city_fips'}, inplace=True)\ncensus_df.drop(columns={'StateAbbr', 'PlaceName'}, inplace=True)\ncensus = census_df[['city', 'Population2010', 'ACCESS2_CrudePrev' , 'ARTHRITIS_CrudePrev', 'BPHIGH_CrudePrev', 'CANCER_CrudePrev', \n                     'CASTHMA_CrudePrev', 'CHD_CrudePrev', 'CHECKUP_CrudePrev', 'COLON_SCREEN_CrudePrev', 'DIABETES_CrudePrev', \n                     'KIDNEY_CrudePrev', 'LPA_CrudePrev', 'MHLTH_CrudePrev', 'OBESITY_CrudePrev', 'PHLTH_CrudePrev', 'SLEEP_CrudePrev',\n                     'STROKE_CrudePrev']] \ncensus = census.groupby('city').agg('mean')\ncensus_unique = pd.DataFrame([census_df[census_df.city==x].values[0] for x in census_df.city.unique() if len(census_df[census_df.city==x].values)>0], \n                             columns=census_df.columns)[['city_fips', 'city', 'state_name', 'lat', 'lng', 'population', 'density', 'source', 'military',\n                                                      'incorporated', 'ranking']]\ncensus = pd.merge(census, census_unique, on='city', how='left')\ncensus = census[~census.city.isnull()]\n\norg = pd.merge(Locations, US_cities_map, left_on='address_city', right_on='city', how='left')\norg.dropna(inplace=True)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Some Numbers From The Data"},{"metadata":{},"cell_type":"markdown","source":"#### City Data"},{"metadata":{"trusted":true},"cell_type":"code","source":"print('\\nCDP Regions:', cities_data['CDP Region'].nunique())\nprint('Parent Sections:', cities_data['Parent Section'].nunique())\nprint('Sections:', cities_data['Section'].nunique())\nprint('Question Numbers:', cities_data['Question Number'].nunique())\nprint('Questions:', cities_data['Question Name'].nunique())\nprint('Columns:', cities_data['Column Name'].nunique())\nprint('Rows:', cities_data['Row Name'].nunique())\nprint('Account Numbers:', cities_data['Account Number'].nunique())\nprint('Organizations:', cities_data['Organization'].nunique())\nprint('Cities:', cities_data['City'].nunique())\nprint('Countries:', cities_data['Country'].nunique())\nprint('CDP Regions:', cities_data['CDP Region'].nunique())\nprint('Reporting Authorities:', cities_data['Reporting Authority'].nunique())\nprint('Access Types:', cities_data['Access'].nunique())\nprint('Account Numbers:', cities_data['Account Number'].nunique())","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"#### Corporations Data"},{"metadata":{"trusted":true},"cell_type":"code","source":"print('Number of organizations:',Corporates_Climate_Water_Dataset.organization.nunique())\nprint('Modules:',Corporates_Climate_Water_Dataset.module_name.nunique())\nprint('Questions:',Corporates_Climate_Water_Dataset.question_number.nunique())\nprint('Columns',Corporates_Climate_Water_Dataset.column_name.nunique())\nprint('Rows:',Corporates_Climate_Water_Dataset.row_name.nunique())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"del Full_Cities_Dataset \ndel Cities_Disclosing_to_CDP \ndel Social_Vulnerability_Index_2018_county \ndel Corporates_Disclosing_to_CDP_Water_Security\ndel Corporates_Disclosing_to_CDP_Climate_Change\ndel Full_Water_Security_Dataset\ndel Full_Climate_Change_Dataset\ngc.collect()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Functions used for automated insight generation"},{"metadata":{"trusted":true},"cell_type":"code","source":"columns = ['ACCESS2_CrudePrev',\t'ARTHRITIS_CrudePrev', 'BPHIGH_CrudePrev', 'CANCER_CrudePrev', 'CASTHMA_CrudePrev',\t'CHD_CrudePrev',\t'CHECKUP_CrudePrev',\t'COLON_SCREEN_CrudePrev',\t'DIABETES_CrudePrev', 'KIDNEY_CrudePrev', 'LPA_CrudePrev', 'MHLTH_CrudePrev', 'OBESITY_CrudePrev',\t'PHLTH_CrudePrev', 'SLEEP_CrudePrev', 'STROKE_CrudePrev']\n\n\"\"\"\nUsed to aggregate data over different years (2018, 2019, 2020), and plot the final data to make a comparision over the years.\n\"\"\"\ndef corp_wc_yr(cn,mn,xlabel,title,rename_18,rename_19,rename_20,annotate=True):\n  data = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn][['organization','survey_year','response_value','module_name','column_name']]\n  df = data[data.column_name==cn]\n  df.dropna(inplace=True)\n  df['response_value'] = df['response_value'].astype('float')\n  \n  if df.survey_year.unique().__contains__(2018):\n    df_agg = df[df.survey_year==2018][['organization', 'response_value']]\n    df_agg = df_agg.groupby(['organization']).agg('mean')\n    df_agg.rename(columns={'response_value':rename_18}, inplace=True)\n\n  if df.survey_year.unique().__contains__(2019):\n    df_agg[rename_19] = df[df.survey_year==2019][['organization', 'response_value']].groupby('organization').agg('mean')\n\n  if df.survey_year.unique().__contains__(2020):  \n    df_agg[rename_20] = df[df.survey_year==2020][['organization', 'response_value']].groupby('organization').agg('mean')\n  \n  if df.survey_year.unique().max()==2020:\n    max_year=rename_20\n  elif df.survey_year.unique().max()==2019:\n    max_year=rename_19\n  else:\n    max_year=rename_18\n  df_agg.dropna(inplace=True)\n  df_agg.sort_values(by=max_year, ascending=True, inplace=True)\n  df_agg.tail(15).plot(kind='barh', figsize=(10,10))\n  if annotate:\n    if df.survey_year.unique().__contains__(2018):\n      for index, value in enumerate(df_agg[rename_18].tail(15)): \n        label = format(value, ',')\n        plt.annotate(label, xy=(value, index), color='black')\n    if df.survey_year.unique().__contains__(2019):\n      for index, value in enumerate(df_agg[rename_19].tail(15)): \n        label = format(value, ',')\n        plt.annotate(label, xy=(value, index), color='black')\n    if df.survey_year.unique().__contains__(2020):\n      for index, value in enumerate(df_agg[rename_20].tail(15)): \n        label = format(value, ',')\n        plt.annotate(label, xy=(value, index), color='black')\n  plt.xlabel(xlabel)\n  plt.title(title)\n  plt.show()\n\n\"\"\"\nUsed to make comparision of corporate data after agrregating the data over different years.\n\"\"\"\ndef type_mix(en, qn, rename, data,den):\n  t_mix = cities_data[cities_data['Question Name']==qn]\n  df = t_mix[t_mix['Column Name']==en]\n  df[['Response Answer']] = df[['Response Answer']].astype('float')\n  df_18 = df[df['Year Reported to CDP']==2018]\n  df_19 = df[df['Year Reported to CDP']==2019]\n  df_20 = df[df['Year Reported to CDP']==2020]\n  df_unique = pd.DataFrame([df[df.City==x].values[0] for x in df.City.unique() if len(df[df.City==x].values)>0], \n                            columns=df.columns)[['City', 'Country', \n                                                    'Access', 'Population', 'Population Year', 'Year Reported to CDP', 'City Location']]\n  df_18 = df_18[['City', 'Response Answer']].groupby('City').agg('mean')\n  df_19 = df_19[['City', 'Response Answer']].groupby('City').agg('mean') \n  df_20 = df_20[['City', 'Response Answer']].groupby('City').agg('mean')\n  if rename:\n    df_18.rename(columns={'Response Answer': rename+'_18'}, inplace=True)\n    df_19.rename(columns={'Response Answer': rename+'_19'}, inplace=True)\n    df_20.rename(columns={'Response Answer': rename+'_20'}, inplace=True)\n\n  df = pd.merge(df_18, df_19, on='City', how='left')\n  df = pd.merge(df, df_20, on='City', how='left')\n  df = pd.merge(df, df_unique, on='City', how='left')\n  df.dropna(inplace=True)\n  df.index=df.City\n  df.drop(columns={'Year Reported to CDP','City'}, inplace=True)\n  df = df[df.index.isin(census.city)]\n  df = pd.merge(df, census[census.city.isin(df.index)], how='left', left_on='City', right_on='city')\n  df.index = df.city\n  df.drop(columns={'city'}, inplace=True)\n  df['population']=df['population']/1e5\n  for col in columns:\n    df[col] = df[col]/df['population']\n  df[data] = df[data]/den\n  df.sort_values(by=data, ascending=True,inplace=True)\n  for col in columns:\n    df[[data, col]].tail(15).plot(kind='barh', figsize=(10,5))\n  plt.xlabel('count')\n\n\"\"\"\nUsed to aggregate categotical data over seperate years.\n\"\"\"\ndef type_mix_catg(en,qn,rename,title):\n  t_mix = cities_data[cities_data['Question Name']==qn]\n  df = t_mix[t_mix['Column Name']==en]\n  df.rename(columns={'Response Answer':rename}, inplace=True)\n  df_18 = df[df['Year Reported to CDP']==2018]\n  df_19 = df[df['Year Reported to CDP']==2019]\n  df_20 = df[df['Year Reported to CDP']==2020]\n  df_18 = df_18[['City', rename]].groupby(rename).agg('count')\n  df_19 = df_19[['City', rename]].groupby(rename).agg('count')\n  df_20 = df_20[['City', rename]].groupby(rename).agg('count')\n  df_18.rename(columns={'City':'2018'}, inplace=True)\n  df_19.rename(columns={'City':'2019'}, inplace=True)\n  df_20.rename(columns={'City':'2020'}, inplace=True)\n  df = pd.merge(df_18, df_19, on=rename, how='left')\n  df = pd.merge(df, df_20, on=rename, how='left')\n  df.sort_values(by='2020', ascending=True, inplace=True)\n  df.dropna(inplace=True)\n  df.tail(15).plot(kind='barh', figsize=(10,7))\n  plt.title(title)\n  plt.xlabel('count')\n\n\"\"\"\nUsed to aggregate freight data.\n\"\"\"\ndef type_mix_freight(en, qn, rename):\n  t_mix = cities_data[cities_data['Question Name']==qn]\n  df = t_mix[t_mix['Column Name']==en]\n  df[['Response Answer']] = df[['Response Answer']].astype('float')\n  df_18 = df[df['Year Reported to CDP']==2018]\n  df_19 = df[df['Year Reported to CDP']==2019]\n  df_20 = df[df['Year Reported to CDP']==2020]\n  df_unique = pd.DataFrame([df[df.City==x].values[0] for x in df.City.unique() if len(df[df.City==x].values)>0], \n                            columns=df.columns)[['City', 'Country', \n                                                    'Access', 'Population', 'Population Year', 'Year Reported to CDP', 'City Location']]\n  df_18 = df_18[['City', 'Response Answer']].groupby('City').agg('mean')\n  df_19 = df_19[['City', 'Response Answer']].groupby('City').agg('mean') \n  df_20 = df_20[['City', 'Response Answer']].groupby('City').agg('mean')\n  if rename:\n    df_18.rename(columns={'Response Answer': rename+'_18'}, inplace=True)\n    df_19.rename(columns={'Response Answer': rename+'_19'}, inplace=True)\n    df_20.rename(columns={'Response Answer': rename+'_20'}, inplace=True)\n\n  df = pd.merge(df_18, df_19, on='City', how='left')\n  df = pd.merge(df, df_20, on='City', how='left')\n  df = pd.merge(df, df_unique, on='City', how='left')\n  df.dropna(inplace=True)\n  df.index=df.City\n  df.drop(columns={'Year Reported to CDP','City'}, inplace=True)\n  df = df[df.index.isin(census.city)]\n  df = pd.merge(df, census[census.city.isin(df.index)], how='left', left_on='City', right_on='city')\n  df.index = df.city\n  df.drop(columns={'city'}, inplace=True)\n  df['population']=df['population']/1e5\n  for col in columns:\n    df[col] = df[col]/df['population']\n  return df\n\n\"\"\"\nUsed to plot different bar graphs\n\"\"\"\ndef corp_wc_type(cn,mn,title,rename):\n  df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn]\n  df_sub = df[df.column_name==cn]\n  df_sub.rename(columns={'response_value':rename}, inplace=True)\n  df_sub.rename(columns={'organization':'2020'}, inplace=True)\n  df_sub_agg = df_sub[['2020', rename]].groupby(rename).agg('count')\n  df_sub_agg.sort_values(by='2020', ascending=True, inplace=True)\n  df_sub_agg.tail(15).plot(kind='barh', figsize=(10,7))\n  plt.title(title)\n  plt.xlabel('Number of Organization')\n  for index, value in enumerate(df_sub_agg['2020'].tail(15)):\n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\n  plt.show()\n\ndef corp_wc_risk(cn,mn,title,xlabel,rename):\n  df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn]\n  df = df[~df.response_value.isnull()]\n  df_sub = df[df.column_name==cn]\n  df_sub.rename(columns={'response_value':rename}, inplace=True)\n  df_sub_agg = df_sub[df_sub.survey_year==2019][['organization', rename]].groupby(rename).agg('count')\n  df_sub_agg.rename(columns={'organization':'2019'}, inplace=True)\n  df_sub_agg['2018'] = df_sub[df_sub.survey_year==2018][['organization', rename]].groupby(rename).agg('count')\n  df_sub_agg.sort_values(by='2019', ascending=True, inplace=True)\n  df_sub_agg.tail(15).plot(kind='barh', figsize=(10,7))\n  plt.title(title)\n  plt.xlabel(xlabel)\n  for index, value in enumerate(df_sub_agg['2019'].tail(15)): \n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\n  for index, value in enumerate(df_sub_agg['2018'].tail(15)): \n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\n  plt.show()\n\ndef corp_wc_em(cn, mn, title):\n  df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn]\n  df_sub = df[df.column_name==cn]\n  df_sub['response_value'] = df_sub['response_value'].astype('float')\n  df_sub_agg = df_sub[df_sub.survey_year==2018][['organization','response_value']].groupby('organization').agg('mean')\n  df_sub_agg.rename(columns={'response_value':'2018'}, inplace=True)\n  df_sub_agg['2019'] = df_sub[df_sub.survey_year==2019][['organization','response_value']].groupby('organization').agg('mean')\n  df_sub_agg['2020'] = df_sub[df_sub.survey_year==2020][['organization','response_value']].groupby('organization').agg('mean')\n  df_sub_agg.dropna(how='any', inplace=True)\n  df_sub_agg.sort_values(by='2020', ascending=True, inplace=True)\n  df_sub_agg.tail(15).plot(kind='barh', figsize=(10,7))\n  plt.title(title)\n  plt.xlabel('value')\n    \n\"\"\"\nUsed to plot map and graphs side by side to compare greenhouse gas emission from 2018 to 2020.\n\"\"\"  \ndef greenhouse_em():\n  color = ['red', 'green', 'beige', 'orange', 'pink', 'yellow', 'indigo', 'brown', 'gray', 'white']               \n  limits = list(greenhouse_location.greenhouse_gas.unique())\n  legend_color = {limits[0]:color[0], limits[1]:color[1], limits[2]:color[2], limits[3]:color[3], limits[4]:color[4], limits[5]:color[5], limits[6]:color[6],\n                 limits[7]:color[7], limits[8]:color[8], limits[9]:color[9]}\n  df_18 = greenhouse_location[greenhouse_location.survey_year==2018][['organization', 'greenhouse_gas']].groupby('greenhouse_gas').agg('count')\n  df_18.sort_values(ascending=True, inplace=True, by='organization')\n  df_19 = greenhouse_location[greenhouse_location.survey_year==2019][['organization', 'greenhouse_gas']].groupby('greenhouse_gas').agg('count')\n  df_19.sort_values(ascending=True, inplace=True, by='organization')\n  df_20 = greenhouse_location[greenhouse_location.survey_year==2020][['organization', 'greenhouse_gas']].groupby('greenhouse_gas').agg('count')\n  df_20.sort_values(ascending=True, inplace=True, by='organization')\n\n  fig = make_subplots(rows=6, \n                    cols=2, \n                    column_widths=[0.6, 0.4],\n                    row_heights=[0.6, 0.1, 0.6, 0.1, 0.6, 0.1],\n                    specs=[\n                           [{\"type\": \"scattergeo\", \"rowspan\": 2}, {\"type\": \"bar\"}],\n                           [            None                    , None],\n                           [{\"type\": \"scattergeo\", \"rowspan\": 2}, {\"type\": \"bar\"}],\n                           [            None                    , None],\n                           [{\"type\": \"scattergeo\", \"rowspan\": 2}, {\"type\": \"bar\"}],\n                           [            None                    , None]\n                    ],\n                    subplot_titles=['2018', '', '2019', '', '2020']\n                    )\n\n  for i in range(len(limits)):\n    lim = limits[i]\n    fig.add_trace(\n        go.Scattergeo(\n        locationmode = 'ISO-3', \n        lon = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2018').longitude,\n        lat = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2018').latitude,\n        text = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2018').greenhouse_gas,\n        marker = dict(size = 7, color=legend_color[limits[i]]),\n        name=lim,\n        ),\n        row=1, col=1\n    )\n    fig.add_trace(\n        go.Scattergeo(\n        locationmode = 'ISO-3', \n        lon = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2019').longitude,\n        lat = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2019').latitude,\n        text = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2019').greenhouse_gas,\n        marker = dict(size = 7, color=legend_color[limits[i]]),\n        showlegend=False\n        ),\n        row=3, col=1\n    )\n    fig.add_trace(\n        go.Scattergeo(\n        locationmode = 'ISO-3', \n        lon = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2020').longitude,\n        lat = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2020').latitude,\n        text = greenhouse_location[greenhouse_location.greenhouse_gas==lim].query('survey_year==2020').greenhouse_gas,\n        marker = dict(size = 7, color=legend_color[limits[i]]),\n        showlegend=False\n        ),\n        row=5, col=1\n    )\n\n    \n  fig.add_trace(\n    go.Bar(x=df_18.index,y=df_18['organization'], marker=dict(color='crimson'), showlegend=False),\n    row=1, col=2\n    )\n  \n  fig.add_trace(\n    go.Bar(x=df_19.index,y=df_19['organization'], marker=dict(color='crimson'), showlegend=False),\n    row=3, col=2\n    )\n\n  fig.add_trace(\n    go.Bar(x=df_20.index,y=df_20['organization'], marker=dict(color='crimson'), showlegend=False),\n    row=5, col=2\n    )\n\n  fig.update_geos(\n    resolution=110,\n    showocean=True,\n    showrivers=True,\n    showlakes=True,\n    landcolor=\"white\",\n    oceancolor=\"MidnightBlue\",\n    lakecolor=\"Blue\",\n    rivercolor=\"Blue\"\n  )\n\n  fig.update_layout(\n        template=\"plotly_dark\",\n        height=1000,\n        width=1000,\n        title_text = 'Top 10 common greenhouse gases',\n        showlegend = True,\n        geo = dict(\n            scope = 'world',\n            landcolor = 'rgb(217, 217, 217)',\n        )\n    )\n\n  fig.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"emissions_breakdowns = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name=='C7. Emissions breakdowns']\ncountry = emissions_breakdowns[emissions_breakdowns.column_name=='C7.2_C1Country/Region'][['organization', 'response_value']]\ncountry.dropna(inplace=True)\ncountry.rename(columns={'response_value':'country'}, inplace=True)\n\nlongitude = pd.read_csv('../input/locations/longitude.csv')\nlongitude.dropna(inplace=True)\nlong = []\nunique_org_long = pd.DataFrame(longitude.organization.unique(), columns={'organization'})\nfor i in range(0,len(unique_org_long)):\n  long.append(longitude[longitude.organization==unique_org_long.organization[i]]['longitude'].values[0])\nunique_org_long['longitude'] = long\n\nlatitude = pd.read_csv('../input/locations/latitude.csv')\nlatitude.dropna(inplace=True)\nlat = []\nunique_org_lat = pd.DataFrame(latitude.organization.unique(), columns={'organization'})\nfor i in range(0,len(unique_org_lat)):\n  lat.append(latitude[latitude.organization==unique_org_lat.organization[i]]['latitude'].values[0])\nunique_org_lat['latitude'] = lat\n\nlong_lat = pd.merge(unique_org_long, unique_org_lat, on='organization', how='left')\nactivity = emissions_breakdowns[emissions_breakdowns.column_name=='C7.3c_C1Activity'][['organization', 'response_value']]\nactivity.dropna(inplace=True)\nactivity.rename(columns={'response_value':'activity'}, inplace=True)\ngreenhouse = emissions_breakdowns[emissions_breakdowns.column_name=='C7.1a_C1Greenhouse gas'][['organization', 'response_value', 'survey_year']]\ngreenhouse.dropna(inplace=True)\ngreenhouse.rename(columns={'response_value':'greenhouse_gas'}, inplace=True)\ngreenhouse['greenhouse_gas'] = [x.split(':')[-1] for x in greenhouse.greenhouse_gas]\ncity = emissions_breakdowns[emissions_breakdowns.column_name=='C7.3b_C1Facility'][['organization', 'response_value']]\ncity.dropna(inplace=True)\ncity.rename(columns={'response_value':'city'}, inplace=True)\nbusiness_divission = emissions_breakdowns[emissions_breakdowns.column_name=='C7.6a_C1Business division'][['organization', 'response_value']]\nbusiness_divission.dropna(inplace=True)\nbusiness_divission.rename(columns={'response_value':'business_divission'}, inplace=True)\n\ntop_activities = activity.activity.value_counts()[0:10]\ntop_greenhouse_gases = greenhouse.greenhouse_gas.value_counts()[0:10]\ntop_business_divisions = business_divission.business_divission.value_counts()[0:10]\n\nactivity_df = activity[activity.activity.isin(top_activities.keys())]\ngreenhouse_df = greenhouse[greenhouse.greenhouse_gas.isin(top_greenhouse_gases.keys())]\n\ngreenhouse_location = pd.merge(greenhouse_df, long_lat, on='organization', how='left')\ngreenhouse_location.dropna(inplace=True)\nactivity_location = pd.merge(activity_df, long_lat, on='organization', how='left')\nactivity_location.dropna(inplace=True)\ngas_count = pd.DataFrame(top_greenhouse_gases)\ngas_count.rename(columns={'greenhouse_gas':'count'}, inplace=True)\ngas_count['greenhouse_gas'] = gas_count.index\ngreenhouse_location = pd.merge(greenhouse_location, gas_count, on='greenhouse_gas',how='left')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Part 1: Key performance indicators (KPI) that relate to the environmental and social issues\n\n#### How were these KPI calculated:\nThe methodology has been derived from an analysis of the impact that the       organization's business have on the environment. The analysis takes into account the response values and remarks given in the data files. These include data like types of activities, emmision figures, social and environmental factors. Based on the questions answered, following KPI have been included:"},{"metadata":{},"cell_type":"markdown","source":"## 1.1. Emissions to air"},{"metadata":{},"cell_type":"markdown","source":"### a) Co2 Emission Factor"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_yr('C8.2d_C1Emission factor','C8. Energy','Emission factor','Highest 15 CO2 emmission factors (from data with both values)','2018','2019','2020',annotate=False)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"It seems, among the companies with highest factor value, there was a decrease from 2018 to 2019."},{"metadata":{},"cell_type":"markdown","source":"### b) Change in supplier-related, customer-related and overall scope 3 emissions \n "},{"metadata":{},"cell_type":"markdown","source":"### With % decrease in number of suppliers"},{"metadata":{"trusted":true},"cell_type":"code","source":"def corp_wc_df(cn, mn, rename_sub):\n  df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn]\n  df_sub = df[df.column_name==cn][['organization','response_value']]\n  df_sub['response_value'] = df_sub['response_value'].astype('float')\n  df_sub = df_sub.groupby('organization').agg('mean')\n  df_sub.rename(columns={'response_value':rename_sub}, inplace=True)\n  return df_sub\n\nsupplier_emmission = corp_wc_df('C12.1a_C5% of supplier-related Scope 3 emissions as reported in C6.5', 'C12. Engagement',\n                                '% of supplier-related Scope 3 emissions')\ncustomer_emmission = corp_wc_df('C12.1b_C4% of customer - related Scope 3 emissions as reported in C6.5', 'C12. Engagement',\n                                '% of customer-related Scope 3 emissions')\ntotal_emmission = corp_wc_df('C12.1a_C5% Scope 3 emissions as reported in C6.5', 'C12. Engagement','% Scope 3 emissions')\n\nsupplier = corp_wc_df('C12.1a_C3% of suppliers by number', 'C12. Engagement','% of suppliers by number')\ncustomer = corp_wc_df('C12.1b_C3% of customers by number', 'C12. Engagement','% of customers by number')\nprocurement = corp_wc_df('C12.1a_C4% total procurement spend (direct and indirect)', 'C12. Engagement',\n                         '% total procurement spend (direct and indirect)')\n\nemmissions = pd.merge(customer_emmission, supplier_emmission, on='organization', how='left')\nemmissions = pd.merge(emmissions, total_emmission, on='organization', how='left')\nemmissions.dropna(how='any', inplace=True)\n\nsupplier_effect = pd.merge(supplier, emmissions, on='organization', how='right')\ncustomer_effect = pd.merge(customer, emmissions, on='organization', how='right')\nprocurement_effect = pd.merge(procurement, emmissions, on='organization', how='right')\n\nsupplier_effect.sort_values(by='% of suppliers by number', ascending=True, inplace=True)\nsupplier_top = supplier_effect[['% of suppliers by number',\n                                '% of supplier-related Scope 3 emissions', \n                                '% of customer-related Scope 3 emissions',\n                                '% Scope 3 emissions'\n                                ]].iloc[::10,:].head(15)\nsupplier_top.plot(kind='barh', figsize=(15,10))\nplt.title('Change in Emmissions with change in % of suppliers by number')\nplt.xlabel('value')\nplt.show()\n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"As the % of suppliers by number decrease, there seems to be a decrease in % of customer related scope 3 emissions. Though % of supplier related and overall scope 3 emissions become more extreme."},{"metadata":{},"cell_type":"markdown","source":"### With  % decrease in number of customers"},{"metadata":{"trusted":true},"cell_type":"code","source":"customer_effect.sort_values(by='% of customers by number', ascending=True, inplace=True)\ncustomer_top = customer_effect[['% of customers by number',\n                                '% of supplier-related Scope 3 emissions', \n                                '% of customer-related Scope 3 emissions',\n                                '% Scope 3 emissions'\n                                ]].iloc[::10,:].head(15)\ncustomer_top.plot(kind='barh', figsize=(15,10))\nplt.title('Change in Emmissions with change in % of customers by number')\nplt.xlabel('value')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again, as the % of customers by number decrease, there seems to be a decrease in % of customer related scope 3 emissions. Though % of supplier related and overall scope 3 emissions become more extreme."},{"metadata":{},"cell_type":"markdown","source":"### With % increase in total procurement spend (direct and indirect)"},{"metadata":{"trusted":true},"cell_type":"code","source":"procurement_effect.sort_values(by='% total procurement spend (direct and indirect)', ascending=True, inplace=True)\nsupplier_top = procurement_effect[['% total procurement spend (direct and indirect)',\n                                '% of supplier-related Scope 3 emissions', \n                                '% of customer-related Scope 3 emissions',\n                                '% Scope 3 emissions'\n                                ]].iloc[::10,:].head(15)\nsupplier_top.plot(kind='barh', figsize=(15,10))\nplt.title('Change in Emmissions with change in % total procurement spend (direct and indirect)')\nplt.xlabel('value')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"As the % total procurement spend (direct and indirect) decrease, the % of customer related scope 3 emissions increase, whereas the overall and suppliers related % scope 3 emissions seem to have become somewhat less extreme."},{"metadata":{},"cell_type":"markdown","source":"### c) Gross global Scope 1 emissions (metric tons CO2e)"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_em('C6.1_C1Gross global Scope 1 emissions (metric tons CO2e)','C6. Emissions data',\n           'Top 15 organizations w.r.t Gross global Scope 1 emissions (metric tons CO2e)')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Overall, there seems to be a decrease in the gross scope 1 emissions of metric tons Co2 in year 2020 compared to 2018 and 2019."},{"metadata":{},"cell_type":"markdown","source":"### d) Gross global Scope 2 market-based emissions"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_em('C6.3_C2Scope 2, market-based (if applicable)','C6. Emissions data',\n           'Top 15 organizations w.r.t Gross global Scope 2 market-based emissions')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again, there seems to be a decrease in the gross scope 2 market based emissions in year 2020 compared to 2018 and 2019."},{"metadata":{},"cell_type":"markdown","source":"### e) Gross global Scope 2 location-based emissions"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_em('C7.5_C2Scope 2, location-based (metric tons CO2e)','C7. Emissions breakdowns',\n           'Top 15 organizations w.r.t Gross global Scope 2 location-based emissions')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Baring a few extreme values, the trend seems to be the same, gross global scope 2 location based emissions have also decreased in 2020."},{"metadata":{},"cell_type":"markdown","source":"## 1.2. Resources consumed"},{"metadata":{},"cell_type":"markdown","source":"### a) Change In Overall MWh Power"},{"metadata":{"trusted":true},"cell_type":"code","source":"def corp_wc_power(cn, mn, rename_sub):\n  df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name==mn]\n  df_sub = df[df.column_name==cn][['organization', 'response_value', 'survey_year']]\n  df_sub['response_value'] = df_sub['response_value'].astype('float')\n  df_sub_agg = pd.DataFrame(columns={'2018','2019'})\n  df_sub_agg['2018'] = df_sub[df_sub.survey_year==2018][['organization','response_value']].groupby(['organization']).agg('mean')['response_value']\n  df_sub_agg['2019'] = df_sub[df_sub.survey_year==2019][['organization','response_value']].groupby(['organization']).agg('mean')['response_value']\n  df_sub_agg[rename_sub] = df_sub_agg['2019'] - df_sub_agg['2018']\n  return df_sub_agg\n  \nmwh_gross = corp_wc_power('C8.2a_C4Total MWh','C8. Energy','gross_change')\nmwh_renewable = corp_wc_power('C8.2a_C2MWh from renewable sources','C8. Energy','renewable_change')\nmwh_non_renewable = corp_wc_power('C8.2a_C3MWh from non-renewable sources','C8. Energy','non_renewable_change')\nmwh = pd.merge(mwh_gross, mwh_renewable, on='organization', how='right')\nmwh = pd.merge(mwh, mwh_non_renewable, on='organization', how='left')\nmwh.dropna(how='any', inplace=True, axis=0)\n\nmwh.sort_values(by='gross_change', ascending=True, inplace=True)\nmwh[['gross_change', 'renewable_change', 'non_renewable_change']].tail(15).plot(kind='barh', figsize=(15,7))\nplt.xlabel('Response Value')\nplt.title('Top 15 Organizations Based On Increase In Overall MWh Power')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Organizations, where overall MWh power use has increased the most from 2018 to 2019, have depended more on non-renewable source of energy to fulfil there demands."},{"metadata":{},"cell_type":"markdown","source":"### b) Change in Renewable MWh Power"},{"metadata":{"trusted":true},"cell_type":"code","source":"mwh.sort_values(by='renewable_change', ascending=True, inplace=True)\nmwh[['gross_change', 'renewable_change', 'non_renewable_change']].tail(15).plot(kind='barh', figsize=(15,7))\nplt.xlabel('Response Value')\nplt.title('Top 15 Organizations Based On Increase In Renewable MWh Power')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"In organizations, where maximum MWh power was obtained from renewable source of energy, the overall power consumption has either decreased from 2018 to 2019, or was very less."},{"metadata":{},"cell_type":"markdown","source":"### c) Change in Non-Renewable MWh Power"},{"metadata":{"trusted":true},"cell_type":"code","source":"mwh.sort_values(by='non_renewable_change', ascending=True, inplace=True)\nmwh[['gross_change', 'renewable_change', 'non_renewable_change']].tail(15).plot(kind='barh', figsize=(15,7))\nplt.xlabel('Response Value')\nplt.title('Top 15 Organizations Based On Increase In Non-Renewable MWh Power')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again, in organizations where the use of non-renewable source of energy was highest, were consuming maximum MWh overall power."},{"metadata":{},"cell_type":"markdown","source":"## 1.3. Risks and Opportunities"},{"metadata":{},"cell_type":"markdown","source":"### a) Increase in Risk Type"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_risk('C2.3a_C3Risk type','C2. Risks and opportunities','Increase in Risk Type','count','Risk Types')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Both transitional and physical risk have increased for organizations from 2018 to 2019."},{"metadata":{},"cell_type":"markdown","source":"### b) Potential Financial Impacts in 2019"},{"metadata":{"trusted":true},"cell_type":"code","source":"risk_op = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name=='C2. Risks and opportunities'][['organization', 'column_name', 'survey_year', 'response_value', 'comments']]\nrisk_op = risk_op[~risk_op.response_value.isnull()]\n\nfinancial_impact_min = risk_op[risk_op.column_name=='C2.3a_C12Potential financial impact figure â€“ minimum (currency)']\nfinancial_impact_min.rename(columns={'response_value':'Potential minimum financial impact'}, inplace=True)\nfinancial_impact_min['Potential minimum financial impact'] = financial_impact_min['Potential minimum financial impact'].astype('float')\nfinancial_impact_min_df = financial_impact_min[['organization', 'Potential minimum financial impact']].groupby('organization').agg('mean')\n\nfinancial_impact_max = risk_op[risk_op.column_name=='C2.3a_C12Potential financial impact figure â€“ minimum (currency)']\nfinancial_impact_max.rename(columns={'response_value':'Potential maximum financial impact'}, inplace=True)\nfinancial_impact_max['Potential maximum financial impact'] = financial_impact_max['Potential maximum financial impact'].astype('float')\nfinancial_impact_max_df = financial_impact_max[['organization', 'Potential maximum financial impact']].groupby('organization').agg('mean')\n\nfinancial_impact_all = pd.merge(financial_impact_min_df, financial_impact_max_df, on='organization', how='left')\nfinancial_impact_all.dropna(how='any', inplace=True)\nfinancial_impact_all.sort_values(by='Potential maximum financial impact', ascending=True, inplace=True)\n\nfinancial_impact_all.tail(15).plot(kind='barh', figsize=(15,10))\nplt.xlabel('Financial Impact')\nplt.title('Some Potential Financial Impacts in 2019')\nfor index, value in enumerate(financial_impact_all['Potential minimum financial impact'].tail(15)): \n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\nfor index, value in enumerate(financial_impact_all['Potential maximum financial impact'].tail(15)): \n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Potential financial impact seems to be highest in banking and energy related sectors."},{"metadata":{},"cell_type":"markdown","source":"### c) Counts of various impact levels"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_risk('C2.3a_C9Magnitude of impact','C2. Risks and opportunities','Counts of various impact levels','count','Impact Levels')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"In almost all categories, magnitude of impact has increased from 2018 to 2019. Medium level impacts have increased the most."},{"metadata":{},"cell_type":"markdown","source":"### d) Cases of various types of Opportunity"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_risk('C2.4a_C3Opportunity type','C2. Risks and opportunities','Cases of various types of Opportunity','count','Opportunity Types')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Opportunities have also increased from 2018 to 2019. Interestingly, resource efficiency opportunity has the highest count."},{"metadata":{},"cell_type":"markdown","source":"### e) Time horizon level counts"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_risk('C2.3a_C7Time horizon','C2. Risks and opportunities','Time horizon level counts','count','Horizen Levels')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again the count has increase in 2019 from 2018. Medium-term time horizen is the most common."},{"metadata":{},"cell_type":"markdown","source":"## 1.4. Targets and performance"},{"metadata":{},"cell_type":"markdown","source":"### a) KPI measure at base and target level"},{"metadata":{"trusted":true},"cell_type":"code","source":"tg_pr = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name=='C4. Targets and performance'][['organization', 'column_name', 'survey_year', 'response_value', 'comments']]\n\nkpi_base = tg_pr[tg_pr.column_name=='C4.2_C7KPI in baseline year']\nkpi_target = tg_pr[tg_pr.column_name=='C4.2_C8KPI in target year']\nkpi_base['response_value'] = kpi_base['response_value'].astype('float')\nkpi_target['response_value'] = kpi_target['response_value'].astype('float')\nkpi_base_agg = kpi_base[['organization', 'response_value']].groupby('organization').agg('mean')\nkpi_target_agg = kpi_target[['organization', 'response_value']].groupby('organization').agg('mean')\nkpi_target_agg.dropna(how='any', inplace=True)\nkpi_base_agg.dropna(how='any', inplace=True)\nkpi_base_agg.rename(columns={'response_value':'KPI Base'}, inplace=True)\nkpi_target_agg.rename(columns={'response_value':'KPI Target'}, inplace=True)\nkpi = pd.merge(kpi_base_agg, kpi_target_agg, on='organization', how='left')\nkpi.dropna(how='any', inplace=True)\nkpi.sort_values(by='KPI Target', ascending=True, inplace=True)\nkpi.tail(10).plot(kind='barh', figsize=(10,5))\nplt.title('KPI measure at base and target level')\nplt.xlabel('value')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"KPI in target year seems to have increased in most cases."},{"metadata":{},"cell_type":"markdown","source":"### b) Revenue from low carbon product(s) in the reporting year"},{"metadata":{"trusted":true},"cell_type":"code","source":"revenue_low_carbon = tg_pr[tg_pr.column_name=='C4.5a_C5% revenue from low carbon product(s) in the reporting year']\nrevenue_low_carbon['response_value'] = revenue_low_carbon['response_value'].astype('float')\nrevenue_low_carbon_agg = revenue_low_carbon[revenue_low_carbon.survey_year==2018][['organization','response_value']].groupby('organization').agg('mean')\nrevenue_low_carbon_agg.rename(columns={'response_value':'% revenue in 2018'}, inplace=True)\nrevenue_low_carbon_agg['% revenue in 2019'] = revenue_low_carbon[revenue_low_carbon.survey_year==2019][['organization','response_value']].groupby('organization').agg('mean')\nrevenue_low_carbon_agg['% revenue in 2020'] = revenue_low_carbon[revenue_low_carbon.survey_year==2020][['organization','response_value']].groupby('organization').agg('mean')\nrevenue_low_carbon_agg.dropna(how='any', inplace=True)\nrevenue_low_carbon_agg.sort_values(by='% revenue in 2020', ascending=True, inplace=True)\nrevenue_low_carbon_agg.iloc[::10,:].tail(10).plot(kind='barh', figsize=(10,5))\nplt.title('% Revenue from low carbon product(s) in the reporting year')\nplt.xlabel('value')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Numbers seems to be confusing here, it might become more clear from long term data."},{"metadata":{},"cell_type":"markdown","source":"### c) Estimated annual CO2e savings (metric tonnes CO2e) in 2020"},{"metadata":{"trusted":true},"cell_type":"code","source":"co2_saving = tg_pr[tg_pr.column_name=='C4.3b_C2Estimated annual CO2e savings (metric tonnes CO2e)']\nco2_saving['response_value'] = co2_saving['response_value'].astype('float')\nco2_saving.rename(columns={'response_value':'2020'}, inplace=True)\nco2_saving_agg = co2_saving[['organization', '2020']].groupby('organization').agg('mean')\nco2_saving_agg.sort_values(by='2020', ascending=True, inplace=True)\nco2_saving_agg.dropna(how='any', inplace=True)\nco2_saving_agg.tail(10).plot(kind='barh', figsize=(10,5))\nplt.title('Top 10 Estimated annual CO2e savings (metric tonnes CO2e) in 2020')\nplt.xlabel('Savings')\nfor index, value in enumerate(co2_saving_agg['2020'].tail(10)):\n  label = format(value, ',')\n  plt.annotate(label, xy=(value, index), color='black')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"As the data only consisted values from 2020, its hard to make a conclusion in terms of improvement. But overall, there seems to be a considerable amount savings."},{"metadata":{},"cell_type":"markdown","source":"# Part 2: Intersection between environmental issues and social issues"},{"metadata":{},"cell_type":"markdown","source":"### 2.1. Increase in the emission of greenhouse gases"},{"metadata":{"trusted":true},"cell_type":"code","source":"greenhouse_em()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"It can be seen that the volume of most common greenhouse gases have increase from 2018 to 2019 and from 2019 to 2020."},{"metadata":{},"cell_type":"markdown","source":"### 2.2. Emissions reduction (metric tonnes CO2e)"},{"metadata":{"trusted":true},"cell_type":"code","source":"type_mix('Estimated emissions reduction (metric tonnes CO2e)', 'What actions is your city taking to reduce emissions? \\\nPlease also indicate estimated emissions reduction potential and status of the emissions reduction actions your city has planned.', \n'Co2 reduction', 'Co2 reduction_20',5e5)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"In every single comparision, cases of illness per unit population have increased as Co2e emission reduction reduces."},{"metadata":{},"cell_type":"markdown","source":"### 2.3. Annual distance travelled (kms)"},{"metadata":{"trusted":true},"cell_type":"code","source":"type_mix('Average annual distance travelled (kms)', 'What is the average \\\nannual distance travelled by each transport mode in your city (kms)?', 'distance','distance_20',1e9)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again, as more and more distance is travelled, cases of illness per unit population increase."},{"metadata":{},"cell_type":"markdown","source":"### 2.4. Percentage of Wastewater collected"},{"metadata":{"trusted":true},"cell_type":"code","source":"type_mix('Percentage of wastewater collected', 'Please provide \\\nthe percentage breakdown of the wastewater your city collects and the percentage breakdown of the treatment type for each wastewater type:', \n'wastewater','wastewater_20',1e2)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Though its a mixed result, but in some cases increase in wastewater collected has led to more cases of illness. It could be due to more power consumption for such a process."},{"metadata":{},"cell_type":"markdown","source":"### 2.5. Difference in amount of electricity consumed from polluting and non polluting sources"},{"metadata":{"trusted":true},"cell_type":"code","source":"def type_mix_energy(en, qn, rename):\n  t_mix = cities_data[cities_data['Question Name']==qn]\n  df = t_mix[t_mix['Column Name']==en]\n  df[['Response Answer']] = df[['Response Answer']].astype('float')\n  df_18 = df[df['Year Reported to CDP']==2018]\n  df_19 = df[df['Year Reported to CDP']==2019]\n  df_20 = df[df['Year Reported to CDP']==2020]\n  df_unique = pd.DataFrame([df[df.City==x].values[0] for x in df.City.unique() if len(df[df.City==x].values)>0], \n                            columns=df.columns)[['City', 'Country', \n                                                    'Access', 'Population', 'Population Year', 'Year Reported to CDP', 'City Location']]\n  df_18 = df_18[['City', 'Response Answer']].groupby('City').agg('mean')\n  df_19 = df_19[['City', 'Response Answer']].groupby('City').agg('mean') \n  df_20 = df_20[['City', 'Response Answer']].groupby('City').agg('mean')\n  if rename:\n    df_18.rename(columns={'Response Answer': rename+'_18'}, inplace=True)\n    df_19.rename(columns={'Response Answer': rename+'_19'}, inplace=True)\n    df_20.rename(columns={'Response Answer': rename+'_20'}, inplace=True)\n\n  df = pd.merge(df_18, df_19, on='City', how='left')\n  df = pd.merge(df, df_20, on='City', how='left')\n  df = pd.merge(df, df_unique, on='City', how='left')\n  df.sort_values(by=rename+'_20', ascending=True, inplace=True)\n  df.dropna(inplace=True)\n  df.index=df.City\n  df.drop(columns={'Year Reported to CDP','City'}, inplace=True)\n  return df\nsolar = type_mix_energy('Solar','Please indicate the energy mix of electricity consumed in your city.','solar')\nsolar.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\ncoal = type_mix_energy('Coal','Please indicate the energy mix of electricity consumed in your city.','coal')\ncoal.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\noil = type_mix_energy('Oil','Please indicate the energy mix of electricity consumed in your city.','oil')\noil.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\nbiomass = type_mix_energy('Biomass','Please indicate the energy mix of electricity consumed in your city.','biomass')\nbiomass.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\ngeothermal = type_mix_energy('Geothermal','Please indicate the energy mix of electricity consumed in your city.','geothermal')\ngeothermal.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\nnuclear = type_mix_energy('Nuclear','Please indicate the energy mix of electricity consumed in your city.','nuclear')\nnuclear.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\nhydro = type_mix_energy('Hydro','Please indicate the energy mix of electricity consumed in your city.','hydro')\nwind = type_mix_energy('Wind','Please indicate the energy mix of electricity consumed in your city.','wind')\nwind.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\ngas = type_mix_energy('Gas','Please indicate the energy mix of electricity consumed in your city.','gas')\ngas.drop(columns={'Country', 'Access', 'Population', 'Population Year', 'City Location'}, inplace=True)\nenergy = pd.merge(hydro,solar,on='City',how='left')\nenergy = pd.merge(energy,coal,on='City',how='left')\nenergy = pd.merge(energy,oil,on='City',how='left')\nenergy = pd.merge(energy,biomass,on='City',how='left')\nenergy = pd.merge(energy,geothermal,on='City',how='left')\nenergy = pd.merge(energy,nuclear,on='City',how='left')\nenergy = pd.merge(energy,wind,on='City',how='left')\nenergy = pd.merge(energy,gas,on='City',how='left')\nenergy['safe_energy_18'] = energy['solar_18']+energy['hydro_18']+energy['geothermal_18']+energy['wind_18']+energy['nuclear_18']\nenergy['safe_energy_19'] = energy['solar_19']+energy['hydro_19']+energy['geothermal_19']+energy['wind_19']+energy['nuclear_19']\nenergy['safe_energy_20'] = energy['solar_20']+energy['hydro_20']+energy['geothermal_20']+energy['wind_20']+energy['nuclear_20']                                                                                                                                                                                              \nenergy['unsafe_energy_18'] = energy['coal_18']+energy['biomass_18']+energy['gas_18']+energy['oil_18']\nenergy['unsafe_energy_19'] = energy['coal_19']+energy['biomass_19']+energy['gas_19']+energy['oil_19']\nenergy['unsafe_energy_20'] = energy['coal_20']+energy['biomass_20']+energy['gas_20']+energy['oil_20']\nenergy = energy[['safe_energy_18', 'safe_energy_19', 'safe_energy_20', 'unsafe_energy_18', 'unsafe_energy_19', 'unsafe_energy_20']]\nenergy.dropna(inplace=True)\nenergy = energy[energy.index.isin(census.city)]\nenergy = pd.merge(energy, census[census.city.isin(energy.index)], how='left', left_on='City', right_on='city')\nenergy['population'] = energy['population']/1e5\nenergy['safe_unsafe_diff_per_head'] = (energy['safe_energy_20'] - energy['unsafe_energy_20'] + 100)/energy['population']\nenergy.index = energy.city\nenergy.drop(columns={'city'}, inplace=True)\nenergy.sort_values(by='safe_unsafe_diff_per_head', ascending=True,inplace=True)\nfor col in columns:\n  energy[['safe_unsafe_diff_per_head', col]].tail(15).plot(kind='barh',figsize=(10,5))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"It can be seen that some illness like cancer, diabetes, kidney related, mental health relates and sleep disorder have increased when more unsafe source of energy (from fossil fuel) are used."},{"metadata":{},"cell_type":"markdown","source":"### 2.6. Bus fleet size"},{"metadata":{"trusted":true},"cell_type":"code","source":"buses = type_mix('Number of buses', 'Please provide the total fleet size and number of \\\nvehicle types for the following modes of transport:', 'buses', 'buses_20',1e2)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Overall as the fleet size of public transport has reduced, cases of illness per unit population have increased"},{"metadata":{},"cell_type":"markdown","source":"### 2.7. Number of freight vehicles"},{"metadata":{"trusted":true},"cell_type":"code","source":"freight = type_mix_freight('Number of freight vehicles', 'Please provide the total fleet size and number of \\\nvehicle types for the following modes of transport:', 'freight')\nfreight['freight_20'] = freight['freight_20']/1e2\nfreight = freight[freight.index!='Athens']\nfreight.sort_values(by='freight_20', ascending=True, inplace=True)\nfor col in columns:\n  freight[['freight_20', col]].tail(20).plot(kind='barh', figsize=(10,5))\n  plt.xlabel('count')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"As the volume of freight vehicles have increased, so have cases of illness."},{"metadata":{},"cell_type":"markdown","source":"### 2.8 Cases of various types of risks"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_risk('C2.3a_C4Primary climate-related risk driver','C2. Risks and opportunities','Cases of various types of risks','count','Risk Types')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Weather related acute and chronic risks are the most common types."},{"metadata":{},"cell_type":"markdown","source":"# Part 3: Do city and corporate ambitions take social and environmental factors into account ?"},{"metadata":{},"cell_type":"markdown","source":"### 3.1. Climate Hazards"},{"metadata":{"trusted":true},"cell_type":"code","source":"type_mix_catg('Climate Hazards',\n              'Please list the most significant climate hazards faced by your city and indicate the probability and consequence of these hazards, as well as the expected future change in frequency and intensity.  Please also select the top 3 assets or services that are affected by the climate hazard, and provide a description of the impact.',\n              'hazard','Reduction in city count for various hazards')\ntype_mix_catg('Probability of hazard', 'Please list the most significant climate hazards faced by your city and indicate the probability and consequence of these hazards, as well as the expected future change in frequency and intensity.  Please also select the top 3 assets or services that are affected by the climate hazard, and provide a description of the impact.', \n              'hazard_probability', 'Reduction in city count for various levels hazards')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"There seems to be a lot of good work done at city level, when cases of various hazards and levels of hazards are seen. Both have reduced from 2018 to 2020."},{"metadata":{},"cell_type":"markdown","source":"### 3.2. Presence of organizations"},{"metadata":{"trusted":true},"cell_type":"code","source":"org_count = org[['organization', 'address_city']].groupby('address_city').agg('count')\np = pd.DataFrame([org[org.address_city==x].values[0] for x in org.address_city.unique()], columns=org.columns)[['address_city', 'population']]\norg_count = pd.merge(org_count, p, how='left', on='address_city')\norg_count.index = org_count.address_city\norg_count.drop(columns={'address_city'}, inplace=True)\norg_count.sort_values(by='organization', ascending=True, inplace=True)\norg_count['population']=org_count['population']/1e4\norg_count.iloc[::2,:].plot(kind='barh', figsize=(10,10))\nplt.title('Decrease in number of organization per unit population')\nplt.xlabel('count')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"At the organizational level, a lot of works needs to be done in terms of organizational presence as the organizations seem be be present only at limited locations. This might be the cause for increase in unemployment rate."},{"metadata":{},"cell_type":"markdown","source":"### 3.3. Growth In Primary Industry Categories"},{"metadata":{"trusted":true},"cell_type":"code","source":"df = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name=='C8. Energy'][['organization', 'question_unique_reference', 'module_name', 'comments', 'survey_year', 'column_name', 'response_value']]\n\nprimary_industry_18 = Corporates_Disclosing_to_CDP[Corporates_Disclosing_to_CDP.survey_year==2018][['organization', 'primary_industry']].groupby(['primary_industry']).agg(['count'])\nprimary_industry_18.columns = ['count in 2018']\n\nprimary_industry_19 = Corporates_Disclosing_to_CDP[Corporates_Disclosing_to_CDP.survey_year==2019][['organization', 'primary_industry']].groupby(['primary_industry']).agg(['count'])\nprimary_industry_19.columns = ['count in 2019']\n\nprimary_industry_20 = Corporates_Disclosing_to_CDP[Corporates_Disclosing_to_CDP.survey_year==2020][['organization', 'primary_industry']].groupby(['primary_industry']).agg(['count'])\nprimary_industry_20.columns = ['count in 2020']\n\nprimary_industry = pd.merge(primary_industry_18, primary_industry_19, on='primary_industry', how='left')\nprimary_industry = pd.merge(primary_industry, primary_industry_20, on='primary_industry', how='left')\n\nprimary_industry.transpose().plot(kind='line', figsize=(15, 7))\nplt.title('Growth In Primary Industry Categories')\nplt.ylabel('count')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Apparel and manufacturing have expanded the most. While industries like Biotech, health and pharma seem to be controlled by a small group as there seem to be very less expansion. This might explain the sky rising price of healthcare service and medicine."},{"metadata":{},"cell_type":"markdown","source":"### 3.4. Corporates Disclosing to CDP"},{"metadata":{"trusted":true},"cell_type":"code","source":"year_org_count = Corporates_Disclosing_to_CDP[['organization', 'survey_year']].groupby(['survey_year']).agg(['count'])\nyear_org_count.columns = ['organizations']\nyear_org_count.plot(kind='barh', figsize=(10, 4))\nplt.title('Corporates Disclosing to CDP')\nplt.xlabel('count')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Overall, there seems to be a positive attitude among corporations, as participation has increased from 2018 to 2020."},{"metadata":{},"cell_type":"markdown","source":"### 3.5. Efforts Towards Reducing Emmissions"},{"metadata":{"trusted":true},"cell_type":"code","source":"comments = df[df.question_unique_reference=='State how much fuel in MWh your organization has consumed (excluding feedstocks) by fuel type.'][['organization', 'comments', 'survey_year']]\ncomments.dropna(inplace=True, how='any')\nenergy_source = []\nnon_ren = re.compile('|'.join(['diesel', 'Diesel', 'Kerosene', 'kerosene', 'Gasolene', 'gasolene', 'Gasoline/petrol', 'Coal', 'coal', 'oil', 'Oil']))\nfor i in range(0,len(comments)):\n  if non_ren.search(comments.comments.iloc[i]):\n    energy_source.append('No effort made')\n  else:\n    energy_source.append('Some effort made')\n\ncomments['Level of Effort'] = energy_source\nresponse_index = [i for i in comments[comments['Level of Effort']=='Some effort made']['comments'].index]\n\nno_response = re.compile('|'.join(['gas', 'Gas', 'LPG']))\nfor i in response_index:\n  if no_response.search(comments[comments.index==i].comments.values[0]):\n    comments['Level of Effort'][i] = 'Some Effort'\n  else:\n    comments['Level of Effort'][i] = 'No Response'\n\neffort = comments[['organization', 'Level of Effort']].groupby(['Level of Effort']).agg('count')\neffort.rename(columns={'organization':'2018'}, inplace=True)\neffort.plot(kind='barh', figsize = (10,5))\nvalid = comments.comments.nunique()\nplt.title('Efforts Towards Reducing Emmissions (from {} valid comments)'.format(valid))\nplt.xlabel('count')  \nfor index, value in enumerate(effort['2018']): \n    label = format(value, ',')\n    plt.annotate(label, xy=(value, index), color='black')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Some effort at organizational level has been done by avoiding fuel based energy source."},{"metadata":{},"cell_type":"markdown","source":"### 3.6. Organization undertaking energy-related activity"},{"metadata":{"trusted":true},"cell_type":"code","source":"initiative = df[df.column_name=='C8.2_C1Indicate whether your organization undertakes this energy-related activity'][['organization', 'response_value', 'survey_year']]\ninitiative['response_value'] = initiative['response_value'].astype('str')\ninitiative['2018'] = initiative[initiative.survey_year==2018]['survey_year']\ninitiative['2019'] = initiative[initiative.survey_year==2019]['survey_year']\nin_df = initiative[['2018', '2019', 'response_value']].groupby(['response_value']).agg('count')\nin_df['Percentage Increment '] = (in_df['2019'] - in_df['2018'])/100\nprint('\\nIndicate whether your organization undertakes this energy-related activity')\nin_df","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Looking at the percentage increase in count of organizations who have participated, the count has increased more for those who have not."},{"metadata":{},"cell_type":"markdown","source":"### 3.7. Number of initiatives"},{"metadata":{"trusted":true},"cell_type":"code","source":"tg_pr = Corporates_Climate_Water_Dataset[Corporates_Climate_Water_Dataset.module_name=='C4. Targets and performance'][['organization', 'column_name', 'survey_year', 'response_value', 'comments']]\n\ninitiative = tg_pr[tg_pr.column_name=='C4.3a_C1Number of initiatives']\ninitiative = initiative[~initiative.response_value.isnull()]\ninitiative = initiative[initiative.response_value!='Yes']\ninitiative = initiative[initiative.response_value!='No']\ninitiative.response_value = initiative.response_value.astype('float')\ninitiative_agg = initiative[initiative.survey_year==2019][['organization', 'response_value']].groupby('organization').agg('mean')\ninitiative_agg.rename(columns={'response_value':'2019'}, inplace=True)\ninitiative_agg['2019'] = initiative_agg['2019'].astype('int')\ninitiative_agg['2020'] = initiative[initiative.survey_year==2020][['organization', 'response_value']].groupby('organization').agg('mean')\ninitiative_agg = initiative_agg[~initiative_agg['2020'].isnull()]\ninitiative_agg['2020'] = initiative_agg['2020'].astype('int')\ninitiative_agg.sort_values(by='2020', ascending=True, inplace=True)\ninitiative_agg.tail(10).plot(kind='barh', figsize=(15,5))\nplt.title('Number of initiatives')\nplt.xlabel('count')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Number of initiatives from organizations have increase from 2019 to 2020."},{"metadata":{},"cell_type":"markdown","source":"### 3.8. Activity Types"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_type('C4.3b_C1Activity type','C4. Targets and performance','Top 15 Corporate Activity Types in year 2020','Activity Type')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Energy efficiency type activities semm to be the most common in 2020."},{"metadata":{},"cell_type":"markdown","source":"### 3.9. Initiative Types"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_type('C4.3b_C1Initiative category & Initiative type','C4. Targets and performance','Top 15 Corporate Initiative Types in year 2020',\n             'Initiative Type')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Power related activity types like lightning, heating, ventilation, air conditioning and process optimization are the most common corporate activity type in 2020."},{"metadata":{},"cell_type":"markdown","source":"### 3.10. Target Type"},{"metadata":{"trusted":true},"cell_type":"code","source":"corp_wc_type('C4.2b_C5Target type: category & Metric (target numerator if reporting an intensity target)_G','C4. Targets and performance',\n             'Top 15 Corporate Target Types in year 2020','Target Type')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Again energy consuption or efficiency and waste management are the most common corporate activity type in 2020."},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}