{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":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)\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":{},"cell_type":"markdown","source":"# Reading the data\n## Reading energy comsuption data"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy = pd.read_csv('/kaggle/input/ashrae-energy-prediction/train.csv', parse_dates=['timestamp'])\ndf_test_energy = pd.read_csv('/kaggle/input/ashrae-energy-prediction/test.csv', parse_dates=['timestamp'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"Training data's shape \" + str(df_train_energy.shape))\nprint(\"Testing data's shape \" + str(df_test_energy.shape))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"The test set is much larger than the training set."},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy.head(10)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy.describe()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"There are 1449 buildings and 4 types of meters: 0: electricity, 1: chilledwater, 2: steam, 3: hotwater"},{"metadata":{},"cell_type":"markdown","source":"### Disctinct values"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy.nunique()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy['meter'] = df_train_energy['meter'].astype('category')\ndf_test_energy['meter'] = df_train_energy['meter'].astype('category')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"Min date train energy \" + str(df_train_energy['timestamp'].min()))\nprint(\"Max date train energy \" + str(df_train_energy['timestamp'].max()))\nprint(\"Min date test energy \" + str(df_test_energy['timestamp'].min()))\nprint(\"Max date test energy \" + str(df_test_energy['timestamp'].max()))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"As you will see below, the **train** and **test** sests of the **energy usage's** data seem to have the **exact same dates** as the **weather's data**."},{"metadata":{},"cell_type":"markdown","source":"### Missing values"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_energy.isna().sum()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"There are **no missing values**, however, not every building has all meter types."},{"metadata":{},"cell_type":"markdown","source":"## Reading buldings' metadata"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata = pd.read_csv('/kaggle/input/ashrae-energy-prediction/building_metadata.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata.info()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata.nunique()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Missing values"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_metadata.isna().sum()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**year_built** and **floor_count** have **lots of missing values** that should be analysed."},{"metadata":{},"cell_type":"markdown","source":"## Reading the weather data"},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_weather = pd.read_csv('/kaggle/input/ashrae-energy-prediction/weather_train.csv', parse_dates=['timestamp'])\ndf_test_weather = pd.read_csv('/kaggle/input/ashrae-energy-prediction/weather_test.csv', parse_dates=['timestamp'])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_train_weather.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(df_train_weather.nunique())\nprint(df_test_weather.nunique())","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(\"Min date train weather \" + str(df_train_weather['timestamp'].min()))\nprint(\"Max date train weather \" + str(df_train_weather['timestamp'].max()))\nprint(\"Min date test weather \" + str(df_test_weather['timestamp'].min()))\nprint(\"Max date test weather \" + str(df_test_weather['timestamp'].max()))","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}