This works for me well. Before rebuilding, make sure the arrays are numpy arrays.
import numpy as np
from sklearn.linear_model import LinearRegression
X = np.asarray([ 1994., 1995., 1996., 1997., 1998., 1999.])
y = np.asarray([1.2, 2.3, 3.4, 4.5, 5.6, 6.7])
clf = LinearRegression()
clf.fit(X.reshape(-1,1),y)
clf.predict([1997])
clf.predict([2001])
source
share