title: Scikit-learn pipeline TypeError: zip argument #2 must support iteration
body: <p>I am trying to create a custom transformer for sklearn pipeline which will extract the average word length of a particular text and then apply standard scaler on it to standardize the dataset. I am passing a Series of texts to the pipeline.</p>
  
  <pre><code>class AverageWordLengthExtractor(BaseEstimator, TransformerMixin):
  
      def __init__(self):
          pass
      def average_word_length(self, text):
          return np.mean([len(word) for word in text.split( )])
      def fit(self, x, y=None):
          return self
      def transform(self, x , y=None):
          return pd.DataFrame(pd.Series(x).apply(self.average_word_length))
  </code></pre>
  
  <p>then I created a pipeline like this.</p>
  
  <pre><code>pipeline = Pipeline(['text_length', AverageWordLengthExtractor(), 
                           'scale', StandardScaler()])
  </code></pre>
  
  <p>When I execute the fit_transform on this pipeline I am getting the error,</p>
  
  <pre><code> File "custom_transformer.py", line 48, in &lt;module&gt;
      main()
    File "custom_transformer.py", line 43, in main
      'scale', StandardScaler()])
    File "/opt/conda/lib/python3.6/site-packages/sklearn/pipeline.py", line 114, in __init__
      self._validate_steps()
    File "/opt/conda/lib/python3.6/site-packages/sklearn/pipeline.py", line 146, in _validate_steps
      names, estimators = zip(*self.steps)
  TypeError: zip argument #2 must support iteration
  </code></pre>