title: Shape not aligned error in OLS Regression python
body: <p>I have a <code>dataframe</code> where I am trying to run the <code>statsmodel.api</code> OLS regression.
  It is printing out the summary. But when I am using the <code>predict()</code> function, it is giving me an error - </p>
  
  <blockquote>
    <p>shapes (75,7) and (6,) not aligned: 7 (dim 1) != 6 (dim 0)</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>X = newdf.loc[:, newdf.columns != 'V-9'].values
  y = newdf.iloc[:,3].values
  from sklearn.model_selection import train_test_split
  X_train,X_test,y_train,y_test = train_test_split(X,y,test_size = 
  0.2,random_state=0)
  import statsmodels.formula.api as sm
  model = sm.OLS(y_train,X_train[:,[0,1,2,3,4,6]])
  result = model.fit()
  print(result.summary())`
  </code></pre>
  
  <p>Error comes on running this: </p>
  
  <pre><code>y_pred = result.predict(X_test)
  </code></pre>
  
  <p>Shape of my <code>X_train</code> is - <code>(297,7)</code><br>
  Shape of my <code>X_test</code> is - <code>(75,7)</code><br>
  <code>dtype</code> is <code>numpy.ndarray</code></p>
  
  <p>This question has been asked before. I have followed some posts on stackoverflow.com and tried to solve it using <code>reshape</code> function. However, it didnt help me. Can anyone explain why I am getting this error? and what is the solution?</p>