I am working with a quarterly data matrix as such:
Qtrs,Y,X,,,
1Q11, 252.0 , 0.0166 ,1,0,0
2Q11, 212.4 , 0.0122 ,0, 1 ,0
3Q11, 425.9 , 0.0286 ,0,0, 1
4Q11, 522.3 , 0.0322 ,0,0,0
1Q12, 263.2 , 0.0185 ,1,0,0
2Q12, 238.6 , 0.0131 ,0, 1 ,0
3Q12, 411.3 , 0.0270 ,0,0, 1
4Q12, 538.4 , 0.0343 ,0,0,0
1Q13, 272.0 , 0.0180 ,1,0,0
2Q13, 212.3 , 0.0122 ,0, 1 ,0
3Q13, 405.2 , 0.0257 ,0,0, 1
4Q13, 495.8 , 0.0308 ,0,0,0
1Q14, 264.5 , 0.0179 ,1,0,0
2Q14, 211.2 , 0.0116 ,0, 1 ,0
I am using the following code to read the csv data file in and fit the model:
import pandas as pd
from sklearn.linear_model import LinearRegression
data = pd.read_csv('C:/Filepath/Macro.csv')
regressor = LinearRegression()
regressor.fit(data['X'], data['Y'])
However the error I get when executing the code is:
ValueError: Found arrays with inconsistent numbers of samples: [ 1 14]
Any idea what basic error I am committing?