title: StatsModel logit.predict error: Number of rows mismatch between data argument and new values
body: <p>I have a train dataframe(227845 lines) and a test dataframe (56962 lines).
  What I want to do is to run a statsmodel logit regression on the train data and then predict the values for the test data. But after I train my model when I try to predict the test values I get the error :</p>
  
  <pre><code>PatsyError: Number of rows mismatch between data argument and train.loc[:, train.columns != 'Class'] (56962 versus 227845)
  train['Class'] ~ train.loc[:, train.columns != 'Class']
  </code></pre>
  
  <p>My steps for the analysis are:</p>
  
  <pre><code>import statsmodels.formula.api as smf
  from statsmodels.formula.api import logit
  from sklearn.model_selection import train_test_split
  
  dataS =  pd.read_csv('sample.csv')
  train, test = train_test_split(dataS , test_size=0.3, random_state=0)
  </code></pre>
  
  <p>Data Columns: </p>
  
  <pre><code>['Time' 'V1' 'V2' 'V3' 'V4' 'V5' 'V6' 'V7' 'V8' 'V9' 'V10' 'V11' 'V12'
   'V13' 'V14' 'V15' 'V16' 'V17' 'V18' 'V19' 'V20' 'V21' 'V22' 'V23' 'V24'
   'V25' 'V26' 'V27' 'V28' 'Amount' 'Class']  
  </code></pre>
  
  <p></p>
  
  <pre><code>mod = logit("dataS['Class']  ~ dataS.loc[:, dataS.columns != 'Class']", data = dataS).fit()
  
  predictions = mod.predict(test.loc[:, test.columns != 'Class'])
  </code></pre>
  
  <p>I tried to run it with <code>sklearn.linear_model.LogisticRegression</code> and with <code>statsmodel.Logit</code> and in both cases <code>predict()</code> was working fine but the statistics for the analysis where not the ones that I expected comparing it with the smf model. </p>
  
  <p>Can someone help?</p>