text_plain_output_1.png
from dateutil.relativedelta import relativedelta

from sklearn.preprocessing import MinMaxScaler

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

data = pd.read_csv('/kaggle/input/hourly-energy-consumption/AEP_hourly.csv')

from sklearn.preprocessing import MinMaxScaler
from dateutil.relativedelta import relativedelta
import datetime
data = data.sort_values(by=['Datetime'])
data['Datetime'] = data['Datetime'].astype('datetime64')
data = data.loc[data['Datetime'] >= data['Datetime'][len(data['Datetime']) - 1] - relativedelta(years=3)]
data.reset_index(inplace=True)
print(data)
scaler = MinMaxScaler()
consumption = scaler.fit_transform(np.reshape(data['AEP_MW'].values, (-1, 1)))[:, 0]
print(consumption)