The first thing you have 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 the associated kwh.
Once you have that, you will want to use sklearn.linear_model.LinearRegression to do the regression. The documentation is here.
As for every sklearn model, there is two step. First you must fit your data. Then, put the dates of which you want to predict the kwh in another array, X_predict, and predict the kwh using the predict method.
from sklearn.linear_model import LinearRegression
X = [] # put your dates in here
y = [] # put your kwh in here
model = LinearRegression()
model.fit(X, y)
X_predict = [] # put the dates of which you want to predict kwh here
y_predict = model.predict(X_predict)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…