title: Automatic feature selection - Sklearn.feature_selection
body: <p>I have two datasets a train and test data. train.shape = (307511, 122) and test.shape = (48744, 121). both these data sets contain these dtype: int32, float64 and object.</p>
  
  <p>I did hot encoding to convert objects to either float or int dtype.</p>
  
  <pre><code>train = pd.get_dummies(train)
  test = pd.get_dummies(test)
  print('Train dummies shape: {}'.format(train.shape))
  print('Test dummies shape: {}'.format(test.shape))
  </code></pre>
  
  <p><em>I got these results from the code above:</em></p>
  
  <pre><code>Train dummies shape: (307511, 246)
  Test dummies shape: (48744, 242)
  </code></pre>
  
  <p>The shape has changed thus HotEncoding has succeeded. But now the problem I am facing is that When I try to train and test my data i get this error:</p>
  
  <pre><code>ValueError: Input contains NaN, infinity or a value too large for dtype('float32')
  </code></pre>
  
  <p>These are my imports:</p>
  
  <pre><code>from sklearn.linear_model import LogisticRegression
  from sklearn.model_selection import train_test_split
  from sklearn.feature_selection import SelectFromModel 
  from sklearn.ensemble import ExtraTreesClassifier
  </code></pre>
  
  <p>Please help</p>