The first thing you need to do is split your data into two arrays X and Y. Each element of X will be a date, and the corresponding element of y will be associated with kwh.
After that, you will want to use sklearn.linear_model.LinearRegression to perform the regression. The documentation is here .
As with every sklearn model, there are two steps. You must match your data first. Then specify the dates at which you want to predict kwh in another array, X_predict and predict kwh using the prediction method.
from sklearn.linear_model import LinearRegression X = []
source share