{"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\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\nfrom sklearn.linear_model import LinearRegression\n\n# Input data files are available in the read-only \"../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# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"data = pd.read_csv(\"/kaggle/input/ashrae-energy-prediction/weather_train.csv\")\ntarg = pd.read_csv(\"/kaggle/input/ashrae-energy-prediction/train.csv\")\nmeta = pd.read_csv(\"/kaggle/input/ashrae-energy-prediction/building_metadata.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"meta.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x = pd.merge(targ, meta, on=\"building_id\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"targ.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"1.608716 * 10**5","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"3.104670 * 10** 2","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"2.333423 * 10**3","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"3.968185 * 10 ** 2","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"x.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"3.104670 * 10 ** 2","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x.describe()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"high = targ[targ[\"meter_reading\"] > 500000]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"high.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"subset = targ.sample(300000)\nsubset[\"timestamp\"] = pd.to_datetime(subset[\"timestamp\"])\nplt.scatter(subset[\"timestamp\"], subset[\"meter_reading\"])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x[\"meter_reading\"].scatter()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"x.corr()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(data.shape)\nprint(targ.shape)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"pd.merge(targ, data)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data[\"site_id\"].value_counts()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub1 = data[data[\"site_id\"] == 1]\nplt.plot(sub1[\"timestamp\"], sub1[\"air_temperature\"])\nsub2 = data[data[\"site_id\"] == 0]\nplt.plot(sub2[\"timestamp\"], sub2[\"air_temperature\"])","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub[\"timestamp\"].min()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def confidence_plot(df, col, target, rc={'figure.figsize':(15,10)}):\n    sns.set(rc=rc)\n    ax = sns.countplot(x=col, data=df)\n    ax2 = ax.twinx()\n    ax.set_xticklabels(ax.get_xticklabels(),rotation=80)    \n    ax2 = sns.pointplot(x=col, y=target, data=df, color='black', legend=False, errwidth=0.5)\n    ax.grid(False)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data[\"diff\"] = data[\"air_temperature\"] - data[\"sea_level_pressure\"] ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data[\"diff\"].min()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"corr = data.corr()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"corr","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub = data[data[\"site_id\"] == 1]\nsub2 = data[data[\"site_id\"] == 2]\n\n\n_, ax = plt.subplots(2, figsize=(20, 10))\n\nprint(type(tup))\nprint(type(fig))\nprint(type(ax))\n\n\nax[0].plot(sub[\"timestamp\"], sub[\"wind_direction\"])\nax[1].plot(sub[\"timestamp\"], sub[\"wind_speed\"])\n# ax[2].plot(sub[\"timestamp\"], sub[\"sea_level_pressure\"])\n\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"rows = 2\ncols = 3\n\nfig, axes = plt.subplots(nrows=rows, ncols=cols, figsize=(20, 10))\nfor i in range(rows):\n    for j in range(cols):\n        site_id = i+j\n        print(site_id)\n        axes[i, j].plot(data[data[\"site_id\"] == site_id][\"timestamp\"], data[data[\"site_id\"] == i+j][\"air_temperature\"])\n        axes[i, j].plot(data[data[\"site_id\"] == site_id][\"timestamp\"], data[data[\"site_id\"] == i+j][\"dew_temperature\"])        ","execution_count":null,"outputs":[]},{"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}