{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"_kg_hide-input":true,"_kg_hide-output":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport datetime\nfrom datetime import timedelta\n%matplotlib inline\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"#dateparse = lambda dates: [pd.datetime.strptime(d, '%Y-%m-%d %H:%M:%S') for d in dates]\ntrain = pd.read_csv( \"../input/ashrae-energy-prediction/train.csv\")\ntest = pd.read_csv( \"../input/ashrae-energy-prediction/test.csv\")\nbuilding = pd.read_csv( \"../input/ashrae-energy-prediction/building_metadata.csv\")\nweather_train= pd.read_csv( \"../input/ashrae-energy-prediction/weather_train.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"train['timestamp'] = pd.to_datetime(train['timestamp'],format='%Y-%m-%d %H:%M:%S' )\ntest['timestamp'] = pd.to_datetime(test['timestamp'],format='%Y-%m-%d %H:%M:%S' )\nweather_train['timestamp'] = pd.to_datetime(weather_train['timestamp'],format='%Y-%m-%d %H:%M:%S' )","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Exploring Time Series in Train and Test data <a></a>"},{"metadata":{},"cell_type":"markdown","source":"train.csv\n* building_id - Foreign key for the building metadata.\n* meter - The meter id code. Read as {0: electricity, 1: chilledwater, 2: steam, hotwater: 3}. Not every building has all meter types.\n* timestamp - When the measurement was taken\n* meter_reading - The target variable. Energy consumption in kWh (or equivalent). Note that this is real data with measurement error, which we expect will impose a baseline level of modeling error."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"print('Number of buildings included in  train is', train.building_id.nunique() ,',starting with id number',train.building_id.min(),'and ending with id number',train.building_id.max())\nprint('Number of buildings included in  test is', test.building_id.nunique() ,',starting with id number',test.building_id.min(),'and ending with id number',test.building_id.max()  )","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Both train and test covers the same buildings. The first plot below shows the counts of meter type in the buildings and second plot shows the number of buildings with the number of meter types "},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"def vertlabel(plot):\n    for p in plot.patches[0:]:\n        h = p.get_height()\n        x = p.get_x()+p.get_width()/2.\n        if h != 0:\n            plot.annotate(\"%g\" % p.get_height(), xy=(x,h), xytext=(0,4), rotation=90, \n                           textcoords=\"offset points\", ha=\"center\", va=\"bottom\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df = train.groupby(['building_id','meter']).size().reset_index().rename(columns={0:'count'})\ndf.drop('count',axis=1,inplace=True)\ndf_meter = df.groupby(['meter']).size().reset_index().rename(columns={0:'count'})\ndf_build = df.groupby(['building_id']).size().reset_index().rename(columns={0:'count'})\nbuild_meter= df_build['count'].value_counts()\nsns.set(rc={'figure.figsize':(12,6)})\nplt.subplot(1,2,1)\nbar1=sns.barplot(x=df_meter.meter,y= df_meter['count'])\nbar1.set(ylim=(0,1600),title= \"Count of Buildings Vs type of meter\")\nvertlabel(bar1)\nplt.subplot(1,2,2)\nbar2 = sns.barplot(x=build_meter.index,y= build_meter.values)\nbar2.set(ylim=(0,1000),title= \"Count of Buildings Vs Number of types of  installed meter\",xlabel= \"Number of types of  installed meter\")\nvertlabel(bar2)\nplt.tight_layout(pad=2, w_pad=5, h_pad=1.0)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"len(df)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The total number of building_id - meter combination is 2380. Each of this can be considered as a seperate time series."},{"metadata":{},"cell_type":"markdown","source":"Let's explore the time stamp column "},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"print('Start time for the time series  in train dataset is :',train.timestamp.min())\nprint('End time for the time series in train dataset is :',train.timestamp.max())\nprint('Number of time points for the time series  in train dataset is :',train.timestamp.nunique())\nprint('Start time for the time series  in test dataset is :',test.timestamp.min())\nprint('End time for the time series in test dataset is :',test.timestamp.max())\nprint('Number of time points for the time series  in test dataset is :',test.timestamp.nunique())","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"From the above it's clear that in the train dataset we have one year data for each house. From the number of time points it's clear that energy consumption reading is taken every hour as 24*366 = 8784 (2016 being a leap year).has \n\nIt will be interestingg to check if every building_id-meter combination has 8784 datapoints"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_read=train.groupby(['building_id','meter']).size().value_counts().rename(columns={0:'reading_count'})\nbar3= sns.barplot(x= df_read.index[:20],y=df_read.values[:20])\nbar3.set(title='Data points for House- Meter combination - Top Twenty datapoints')\nvertlabel(bar3)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Out of the 2380 Household - meter combination only 720 have hourly data throughout the year . The remaining time series requires further exploration."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_time = train.groupby(['building_id','meter']).agg({'timestamp':[min,max,'count']})\ndf_time.columns = [\"_\".join(x) for x in df_time.columns.ravel()]\ndf_time = df_time.reset_index()\nprint('Number of different starting times ',df_time.timestamp_min.nunique())\nprint('Number of different ending times ',df_time.timestamp_max.nunique())","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"There are  a total of 46 different start time and 15 different ending times for 2380 building-meter combination time series. From the below table 2290 out 2380 time series start at  '2016-01-01 00:00:00' and end at '2016-12-31 23:00:00'\t."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"pd.crosstab(df_time[df_time.timestamp_max==df_time.timestamp_max.max()]['timestamp_min'],df_time[df_time.timestamp_max==df_time.timestamp_max.max()]['timestamp_max'],margins=True)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The end times for another 14 series is different from  '2016-12-31 23:00:00' and details are as below.\t."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"pd.crosstab(df_time[df_time.timestamp_max<df_time.timestamp_max.max()]['timestamp_min'],df_time[df_time.timestamp_max<df_time.timestamp_max.max()]['timestamp_max'],margins=True)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Let's check how many values are missing in the different time series The column missing_time_points gives the number of points miising which is Expected_count- timestamp_count"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"datetimeFormat = '%Y-%m-%d %H:%M:%S'\ndf_time['Expected_count'] = (df_time['timestamp_max']- df_time['timestamp_min']).astype('timedelta64[h]')+1\ndf_time['missing_time_points']= df_time['Expected_count'] - df_time['timestamp_count']\ndf_time['percent_missing_time_points']= ((df_time['missing_time_points']/df_time['Expected_count'])*100).round(2)\ndf_time.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The plot below shows the distribution of the 724 time series without missing points and 1186 time series with less than 1% missing points  type of meter wise."},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"sns.set(rc={'figure.figsize':(10,4)})\nfull_data= df_time[df_time.percent_missing_time_points==0]['meter'].value_counts()\nper99_data = df_time[(df_time.percent_missing_time_points>0)& (df_time.percent_missing_time_points<1)]['meter'].value_counts()\ndata = pd.DataFrame({'meter':full_data.index, 'No_missing' : full_data.values,'one_percent_missing' : per99_data.values })\nbar4 = data.set_index('meter').T.plot(kind='bar', stacked=True)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"#### 22 time series below have more than 2000 missing points and 24 have more than 20% data missing"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_time[df_time.percent_missing_time_points>20]","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The meter wise distribution of time series with missing data points between 1 and 20% is plotted below"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_time_missing = df_time[(df_time.percent_missing_time_points>1) & (df_time.percent_missing_time_points<21)]\nmeter0=df_time_missing.percent_missing_time_points[df_time_missing.meter==0]\nmeter1=df_time_missing.percent_missing_time_points[df_time_missing.meter==1]\nmeter2=df_time_missing.percent_missing_time_points[df_time_missing.meter==2]\nmeter3=df_time_missing.percent_missing_time_points[df_time_missing.meter==3]\nhist1=plt.hist([meter0,meter1,meter2,meter3], label=['meter0','meter1','meter2','meter3'],stacked=True)\nplt.legend(loc='upper right')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"Let's  explore the test time series "},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"df_time_test = test.groupby(['building_id','meter']).agg({'timestamp':[min,max,'count']})\ndf_time_test.columns = [\"_\".join(x) for x in df_time_test.columns.ravel()]\ndf_time_test = df_time_test.reset_index()\nprint('Number of different starting times ',df_time_test.timestamp_min.nunique())\nprint('Number of different ending times ',df_time_test.timestamp_max.nunique())","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Interestingly unlike train dataset  test data set has  a common starting time and common ending time.**\n\nLet's check if there are any missing time points."},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"df_time_test['Expected_count'] = (df_time_test['timestamp_max']- df_time_test['timestamp_min']).astype('timedelta64[h]')+1\ndf_time_test['missing_time_points']= df_time_test['Expected_count'] - df_time_test['timestamp_count']\ndf_time_test['percent_missing_time_points']= ((df_time_test['missing_time_points']/df_time_test['Expected_count'])*100).round(2)\ndf_time_test.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"len(df_time_test[df_time.missing_time_points>0])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"markdown","source":"**No missing time points in test data set.**"},{"metadata":{},"cell_type":"markdown","source":"# Buildings- Details & Energy Consumption <a></a>"},{"metadata":{},"cell_type":"markdown","source":"Let's explore  building_meta_data file"},{"metadata":{"trusted":true},"cell_type":"code","source":"building.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"sns.set(rc={'figure.figsize':(12,6)})\ncount1= sns.countplot(data=building,x='site_id')\ncount1.set(title= 'Number of Buildings site wise')\nvertlabel(count1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"sns.set(rc={'figure.figsize':(12,6)})\nfrom textwrap import wrap\nlabels = building['primary_use'].unique()\nlabels = [ '\\n'.join(wrap(l, 15)) for l in labels ]\ncount2= sns.countplot(data=building,x='primary_use')\ncount2.set(title= 'Number of Buildings primary use wise')\ncount2.set_xticklabels(labels,rotation=90)\nvertlabel(count2)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"from matplotlib.colors import ListedColormap\nsns.set(rc={'figure.figsize':(12,6)})\nsns.set_style(\"whitegrid\")\n#qualitative_colors = sns.color_palette(\"Set3\", 16)\nmy_cmap = ListedColormap(sns.color_palette(\"Paired\", 16).as_hex())\ndf_plot = building.groupby(['site_id', 'primary_use']).size().reset_index().pivot(columns='primary_use', index='site_id', values=0)\nplot1= df_plot.plot(kind='bar', stacked=True,colormap=my_cmap)\nplot1.set(title= \"Buildings by site and primary use\")\nplt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"label=(25000,50000,100000,150000,200000,300000,400000,600000,800000)\nbox1=sns.boxplot(data=building,y=\"square_feet\",x='primary_use')\nbox1.set_xticklabels(box1.get_xticklabels(),rotation=90,fontsize=10)\nbox1.set_yticks(label)\nbox1.set_title('Building Area by Primary use')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The histogram below shows the distribution of hourly meter reading that are zero or missing in time series (combination of building_id and meter) "},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_reading = train.groupby(['building_id','meter']).agg({'meter_reading':[min,max,'mean','count']})\ndf_reading.columns = [\"_\".join(x) for x in df_reading.columns.ravel()]\ndf_reading = df_reading.reset_index()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_zero=train[train['meter_reading']==0].groupby(['building_id','meter']).size().reset_index().rename(columns={0:'zero_count'})\ndf_reading= df_reading.merge(df_zero,on=['building_id','meter'],how='left')\ndf_reading['zero_count'].fillna(0,inplace=True)\ndf_reading['zero_count_per'] = ((df_reading['zero_count']/df_reading['meter_reading_count'])*100).round(2)\n                                ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"#df_reading.zero_count_per[df_reading.zero_count_per>0].hist()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_reading= df_reading.merge(df_time,on=['building_id','meter'],how='left')\ndf_reading= df_reading.merge(building,on=['building_id'],how='left')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"df_reading['total_per'] = df_reading['percent_missing_time_points'] + df_reading['zero_count_per']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"hist1=plt.hist(df_reading['total_per'][df_reading['total_per']>5],bins=(5,10,20,30,50,75,100)) \n","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The grid plot below is of  zerometer readings  against all zero or missing hourly meter readings by primary use of different building types."},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(df_reading,col='meter',row='primary_use',margin_titles=True,sharex=False,sharey=False)\ng.map(sns.scatterplot,'total_per','zero_count_per')\nplt.tight_layout()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true,"_kg_hide-output":true},"cell_type":"code","source":"# Code for generating sample rows within groups\nfrom random import sample\ndf_reading.groupby('primary_use',group_keys=False).apply(lambda x : x.sample(min(len(x),2)))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"building_type_details=df_reading.groupby(['primary_use','meter']).agg({'meter_reading_mean': 'mean','square_feet':'mean','building_id':'count'})\nbuilding_type_details=building_type_details.reset_index()\nbuilding_type_details.rename(columns={'square_feet' :'avg_sq_feet','building_id': 'building_count'},inplace= True)\nfor column in ('meter_reading_mean','avg_sq_feet'):\n    building_type_details[column]=building_type_details[column].astype(int)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"building_type_details['meter'] = building_type_details['meter'].map({0: 'electricity', 1: 'chilledwater', 2: 'steam',3: 'hotwater'})","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"from textwrap import wrap\nlabels = building_type_details['primary_use'].unique()\nlabels = [ '\\n'.join(wrap(l, 15)) for l in labels ]\ng= sns.catplot(x='primary_use',y='meter_reading_mean',row='meter',data=building_type_details,kind='bar',aspect=4,sharex=False,sharey=False)\n(g.set_xticklabels(labels,rotation=90,fontsize=12))\nplt.tight_layout(pad=2, w_pad=5, h_pad=1.0)\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Average Meter readings by primary use of buildings')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Weather trends - Site wise <a></a>"},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"overall = train.merge(building,how='left',on='building_id')\noverall = overall.merge(weather_train,how='left',on=['site_id','timestamp'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"overall['month'] = overall.timestamp.dt.month\noverall['day_month']= overall.timestamp.dt.day\noverall['week']= overall.timestamp.dt.week","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"site_weather= overall.groupby(['site_id','month','day_month']).agg({'air_temperature' :(min,max,'mean'),\n                                                          'dew_temperature' :(min,max,'mean'),\n                                                          'precip_depth_1_hr' :(min,max,'mean'),\n                                                          'sea_level_pressure' :(min,max,'mean'),\n                                                         'wind_speed' :(min,max,'mean')})\nsite_weather.columns = [\"_\".join(x) for x in site_weather.columns.ravel()]\nsite_weather = site_weather.reset_index()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id<6],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','air_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','air_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','air_temperature_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of air temperature for Site id 0-5')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[(site_weather.site_id>5) & (site_weather.site_id<11)],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','air_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','air_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','air_temperature_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of air temperature for Site id 6-10')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id>10],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','air_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','air_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','air_temperature_max',color='red')\ng.set_fontsize=14\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of air temperature for Site id 11-15')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id<6],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','dew_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','dew_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','dew_temperature_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of dew temperature for Site id 0-5')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[(site_weather.site_id>5) & (site_weather.site_id<11)],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','dew_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','dew_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','dew_temperature_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of dew temperature for Site id 6-10')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id>10],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','dew_temperature_min',color='lime')\ng.map(sns.lineplot,'day_month','dew_temperature_mean',color='gold')\ng.map(sns.lineplot,'day_month','dew_temperature_max',color='red')\ng.set_fontsize=14\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of dew temperature for Site id 11-15')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id<6],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_min',color='lime')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_mean',color='gold')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of precipitation depth for Site id 0-5')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[(site_weather.site_id>5) & (site_weather.site_id<11) ],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_min',color='lime')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_mean',color='gold')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of precipitation depth for Site id 6-10')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id>10],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_min',color='lime')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_mean',color='gold')\ng.map(sns.lineplot,'day_month','precip_depth_1_hr_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of precipitation depth for Site id 11-15')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id<6],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','sea_level_pressure_min',color='lime')\ng.map(sns.lineplot,'day_month','sea_level_pressure_mean',color='gold')\ng.map(sns.lineplot,'day_month','sea_level_pressure_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of sea level pressure for Site id 0-5')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[(site_weather.site_id>5) & (site_weather.site_id<11)],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','sea_level_pressure_min',color='lime')\ng.map(sns.lineplot,'day_month','sea_level_pressure_mean',color='gold')\ng.map(sns.lineplot,'day_month','sea_level_pressure_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of sea level pressure for Site id 6-10')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id>10],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','sea_level_pressure_min',color='lime')\ng.map(sns.lineplot,'day_month','sea_level_pressure_mean',color='gold')\ng.map(sns.lineplot,'day_month','sea_level_pressure_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of sea level pressure for Site id 11-15')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id<6],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','wind_speed_min',color='lime')\ng.map(sns.lineplot,'day_month','wind_speed_mean',color='gold')\ng.map(sns.lineplot,'day_month','wind_speed_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of Wind speed for Site id 0-5')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[(site_weather.site_id>5) & (site_weather.site_id<11)],col='site_id',row='month',margin_titles=True,sharey='col') \ng.map(sns.lineplot,'day_month','wind_speed_min',color='lime')\ng.map(sns.lineplot,'day_month','wind_speed_mean',color='gold')\ng.map(sns.lineplot,'day_month','wind_speed_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of Wind speed for Site id 6-10')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"g= sns.FacetGrid(site_weather[site_weather.site_id>10],col='site_id',row='month',margin_titles=True,sharey='col')\ng.map(sns.lineplot,'day_month','wind_speed_min',color='lime')\ng.map(sns.lineplot,'day_month','wind_speed_mean',color='gold')\ng.map(sns.lineplot,'day_month','wind_speed_max',color='red')\nplt.tight_layout()\nplt.subplots_adjust(top=0.95)\ng.fig.suptitle('Daily distribution of Wind speed for Site id 11-5')","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":1}