title: Adding scale to my pipeline showing me weird error
body: <pre><code>from sklearn.tree import DecisionTreeRegressor
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import StandardScaler
  
  model = DecisionTreeRegressor()
  my_pipeline = Pipeline(steps=[
      (&quot;scale&quot;, StandardScaler),
      (&quot;preprocessor&quot;, preprocessor),
      (&quot;model&quot;, model)
  ])
  
  my_pipeline.fit(X_train, y_train)
  
  </code></pre>
  <p><strong>Raising the error</strong> <code>AttributeError: 'DataFrame' object has no attribute 'fit'</code>.</p>
  <p>When I run the code without scaling it shows no error but with the scaling, it shows a weird (for me) error.</p>
  <p>So my questions are:</p>
  <ul>
  <li>How can I properly add a scale to my pipeline?</li>
  <li>Why the variable my_pipeline is a pandas object?</li>
  </ul>
  <p><strong>Edit</strong></p>
  <pre><code>#Creation of imputer to deal with missing value for numerical_cols
  from sklearn.impute import SimpleImputer
  numerical_transformer = SimpleImputer(strategy=&quot;mean&quot;)
  
  #Creation of pipe to deal with categorical value and their missing value
  from sklearn.pipeline import Pipeline
  from sklearn.preprocessing import OneHotEncoder
  
  categorical_cols = [cname for cname in X.columns if data[cname].nunique() &lt; 10 and data[cname].dtype == &quot;object&quot;]
  numerical_cols = [cname for cname in X.columns if data[cname].dtypes != &quot;object&quot;]
  numerical_cols.remove(&quot;PassengerId&quot;)
  
  categorical_transformer = Pipeline(steps=[
      (&quot;imputer&quot;, SimpleImputer(strategy='most_frequent')),
      (&quot;onehot&quot;, OneHotEncoder(handle_unknown='ignore'))
  ])
  
  from sklearn.compose import ColumnTransformer
  preprocessor = ColumnTransformer(
      transformers=[
      (&quot;num&quot;, numerical_transformer, numerical_cols),
      (&quot;cat&quot;, categorical_transformer, categorical_cols)
  ])
  
  
  </code></pre>
  <ul>
  <li>The error is line 12 at <code>my_pipeline.fit(X_train, y_train)</code></li>
  </ul>