{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import pandas as pd \n", "from datetime import datetime \n", "from datetime import date\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "from keras.models import Sequential\n", "from keras.layers import LSTM, Dense\n", "from sklearn.model_selection import train_test_split\n", "from sklearn.preprocessing import MinMaxScaler,StandardScaler\n", "from keras.callbacks import ModelCheckpoint\n", "import tensorflow as tf" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "merged = pd.read_csv(r'../data/long_merge.csv')" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "zones = [72, 71, 63, 62, 60, 59, 58,57, 50, 49, 44, 43, 35, 34, 33, 32, 31, 30, 29, 28, ]\n", "rtus = [2]\n", "cols = []\n", "\n", "for zone in zones:\n", " for column in merged.columns:\n", " if f\"zone_0{zone}\" in column and 'co2' not in column and \"hw_valve\" not in column and \"cooling_sp\" not in column and \"heating_sp\" not in column:\n", " cols.append(column)\n", "\n", "for zone in zones:\n", " for column in merged.columns:\n", " if f\"zone_0{zone}\" in column: \n", " if \"cooling_sp\" in column or \"heating_sp\" in column:\n", " cols.append(column)\n", "# for rtu in rtus:\n", "# for column in merged.columns:\n", "# if f\"rtu_00{rtu}_fltrd_sa\" in column:\n", "# cols.append(column)\n", "cols =['date'] + cols + ['air_temp_set_1',\n", " 'air_temp_set_2',\n", " 'dew_point_temperature_set_1d',\n", " 'relative_humidity_set_1',\n", " 'solar_radiation_set_1']\n", "input_dataset = merged[cols]" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\arbal\\AppData\\Local\\Temp\\ipykernel_34660\\1855433847.py:1: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " input_dataset['date'] = pd.to_datetime(input_dataset['date'], format = \"%Y-%m-%d %H:%M:%S\")\n" ] } ], "source": [ "input_dataset['date'] = pd.to_datetime(input_dataset['date'], format = \"%Y-%m-%d %H:%M:%S\")\n", "df_filtered = input_dataset[ (input_dataset.date.dt.date >date(2019, 3, 1)) & (input_dataset.date.dt.date< date(2021, 1, 1))]\n", "\n", "if df_filtered.isna().any().any():\n", " print(\"There are NA values in the DataFrame columns.\")" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | date | \n", "zone_072_temp | \n", "zone_072_fan_spd | \n", "zone_071_temp | \n", "zone_071_fan_spd | \n", "zone_063_temp | \n", "zone_063_fan_spd | \n", "zone_062_temp | \n", "zone_062_fan_spd | \n", "zone_059_temp | \n", "... | \n", "zone_035_heating_sp | \n", "zone_032_cooling_sp | \n", "zone_032_heating_sp | \n", "zone_030_cooling_sp | \n", "zone_030_heating_sp | \n", "air_temp_set_1 | \n", "air_temp_set_2 | \n", "dew_point_temperature_set_1d | \n", "relative_humidity_set_1 | \n", "solar_radiation_set_1 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
511205 | \n", "2019-03-02 00:00:00 | \n", "71.2 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "72.3 | \n", "20.0 | \n", "72.9 | \n", "55.0 | \n", "71.9 | \n", "... | \n", "70.0 | \n", "74.000000 | \n", "68.0 | \n", "73.0 | \n", "67.0 | \n", "11.590 | \n", "11.130 | \n", "3.00 | \n", "55.87 | \n", "120.3 | \n", "
511206 | \n", "2019-03-02 00:01:00 | \n", "71.2 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "72.3 | \n", "20.0 | \n", "72.9 | \n", "55.0 | \n", "71.9 | \n", "... | \n", "70.0 | \n", "74.000000 | \n", "68.0 | \n", "73.0 | \n", "67.0 | \n", "11.590 | \n", "11.130 | \n", "3.00 | \n", "55.87 | \n", "120.3 | \n", "
511207 | \n", "2019-03-02 00:02:00 | \n", "71.2 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "72.3 | \n", "20.0 | \n", "72.6 | \n", "55.0 | \n", "71.9 | \n", "... | \n", "70.0 | \n", "74.000000 | \n", "68.0 | \n", "73.0 | \n", "67.0 | \n", "11.590 | \n", "11.130 | \n", "3.00 | \n", "55.87 | \n", "120.3 | \n", "
511208 | \n", "2019-03-02 00:03:00 | \n", "71.2 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "72.3 | \n", "20.0 | \n", "72.9 | \n", "55.0 | \n", "71.9 | \n", "... | \n", "70.0 | \n", "74.000000 | \n", "68.0 | \n", "73.0 | \n", "67.0 | \n", "11.590 | \n", "11.130 | \n", "3.00 | \n", "55.87 | \n", "120.3 | \n", "
511209 | \n", "2019-03-02 00:04:00 | \n", "71.2 | \n", "40.0 | \n", "71.4 | \n", "20.0 | \n", "72.3 | \n", "20.0 | \n", "72.9 | \n", "55.0 | \n", "71.9 | \n", "... | \n", "70.0 | \n", "74.000000 | \n", "68.0 | \n", "73.0 | \n", "67.0 | \n", "11.590 | \n", "11.130 | \n", "3.00 | \n", "55.87 | \n", "120.3 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
2072148 | \n", "2020-12-31 23:57:00 | \n", "69.5 | \n", "40.0 | \n", "71.2 | \n", "20.0 | \n", "68.0 | \n", "20.0 | \n", "67.6 | \n", "40.0 | \n", "67.5 | \n", "... | \n", "68.0 | \n", "72.714138 | \n", "71.0 | \n", "71.0 | \n", "70.0 | \n", "13.994 | \n", "13.528 | \n", "4.11 | \n", "51.61 | \n", "188.8 | \n", "
2072149 | \n", "2020-12-31 23:58:00 | \n", "69.5 | \n", "40.0 | \n", "71.3 | \n", "20.0 | \n", "68.0 | \n", "20.0 | \n", "67.6 | \n", "40.0 | \n", "67.5 | \n", "... | \n", "68.0 | \n", "72.714138 | \n", "71.0 | \n", "71.0 | \n", "70.0 | \n", "13.994 | \n", "13.528 | \n", "4.11 | \n", "51.61 | \n", "188.8 | \n", "
2072150 | \n", "2020-12-31 23:58:00 | \n", "69.5 | \n", "40.0 | \n", "71.3 | \n", "20.0 | \n", "68.0 | \n", "20.0 | \n", "67.6 | \n", "40.0 | \n", "67.5 | \n", "... | \n", "68.0 | \n", "72.714138 | \n", "71.0 | \n", "71.0 | \n", "70.0 | \n", "13.994 | \n", "13.528 | \n", "4.11 | \n", "51.61 | \n", "188.8 | \n", "
2072151 | \n", "2020-12-31 23:59:00 | \n", "69.5 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "68.0 | \n", "20.0 | \n", "67.6 | \n", "40.0 | \n", "67.5 | \n", "... | \n", "68.0 | \n", "72.714138 | \n", "71.0 | \n", "71.0 | \n", "70.0 | \n", "13.994 | \n", "13.528 | \n", "4.11 | \n", "51.61 | \n", "188.8 | \n", "
2072152 | \n", "2020-12-31 23:59:00 | \n", "69.5 | \n", "40.0 | \n", "71.5 | \n", "20.0 | \n", "68.0 | \n", "20.0 | \n", "67.6 | \n", "40.0 | \n", "67.5 | \n", "... | \n", "68.0 | \n", "72.714138 | \n", "71.0 | \n", "71.0 | \n", "70.0 | \n", "13.994 | \n", "13.528 | \n", "4.11 | \n", "51.61 | \n", "188.8 | \n", "
1560948 rows × 56 columns
\n", "