title: Sklearn: FeatureUnion of heterogenous features gives incompatible row dimensions error with classifier in the pipeline
body: <p>I want to do a binary classification based on different features I have (both text and numerical). Training data is the form of pandas dataframe. My pipeline looks something like this: </p>
  
  <pre><code>final_pipeline = Pipeline([('union', FeatureUnion(
                  transformer_list=[('body_trans', Pipeline([('selector', ItemSelector(key='body')),
                                                            ('count_vect', CountVectorizer())])),
                                    ('body_trans2', Pipeline([('selector', ItemSelector(key='body2')),
                                                            ('count_vect', TfidfVectorizer())])),
                                   ('length_trans', Pipeline([('selector', ItemSelector(key='length')),
                                                             ('min_max_scaler',  MinMaxScaler())]))],
                  transformer_weights={'body_trans': 1.0,'body_trans2': 1.0,'length_trans': 1.0})),
                            ('svc', SVC())])
  </code></pre>
  
  <p>ItemSelector looks like this:</p>
  
  <pre><code>class ItemSelector(BaseEstimator, TransformerMixin):
      def __init__(self, key):
          self.key = key
  
      def fit(self, x, y=None):
          return self
  
      def transform(self, data_frame):
          return data_frame[[self.key]]
  </code></pre>
  
  <p>Now, when I try <code>final_pipeline.fit(X_train, y_train)</code>, it gives me the <code>ValueError: blocks[0,:] has incompatible row dimensions</code> exception. </p>
  
  <pre><code>X_train, X_test, y_train, y_test = train_test_split(train_set, target_set)
  </code></pre>
  
  <p>is how I get my training data. 
  <code>train_set</code> is a dataframe with the fields <code>body</code>, <code>body2</code>, <code>length</code> etc. <code>target_set</code> is a dataframe with only a field called <code>label</code> which is my actual label to classify.</p>
  
  <p>Edit: </p>
  
  <p>I think my input data to the pipeline is not in the proper format. </p>
  
  <p><code>train_set</code> is my training data with the features, sample : </p>
  
  <pre><code>   body           length  body2
  0  blah-blah      193     blah-blah-2
  1  blah-blah-blah 153     blah-blah-blah-2 
  </code></pre>
  
  <p>and the <code>target_set</code>, which is the DataFrame with the classifying label</p>
  
  <pre><code>  label
  0  True
  1  False
  </code></pre>
  
  <p>If there is any tutorial on input format for a Pipeline's fitting parameters using DataFrames, please provide me with a link! I can't find proper documentation as to how to load DataFrames as input for Pipelines while using multiple columns as separate features.</p>
  
  <p>Any help is appreciated!</p>