# Buggy code
def fit(self, X, y, sample_weight=None):
    """Fit the model according to the given training data.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape (n_samples, n_features)
        Training vector, where n_samples is the number of samples and
        n_features is the number of features.

    y : array-like, shape (n_samples,)
        Target values.

    sample_weight : array-like, shape (n_samples,) optional
        Array of weights that are assigned to individual samples.
        If not provided, then each sample is given unit weight.

    Returns
    -------
    self : object
    """
    y = check_array(
        y, accept_sparse=False, force_all_finite=True, ensure_2d=False, dtype="numeric"
    )

    # store the number of dimension of the target to predict an array of
    # similar shape at predict
    self._training_dim = y.ndim

    # transformers are designed to modify X which is 2d dimensional, we
    # need to modify y accordingly.
    if y.ndim == 1:
        y_2d = y.reshape(-1, 1)
    else:
        y_2d = y
    self._fit_transformer(y_2d)

    # transform y and convert back to 1d array if needed
    y_trans = self.transformer_.transform(y_2d)
    # FIXME: a FunctionTransformer can return a 1D array even when validate
    # is set to True. Therefore, we need to check the number of dimension
    # first.
    if y_trans.ndim == 2 and y_trans.shape[1] == 1:
        y_trans = y_trans.squeeze(axis=1)

    if self.regressor is None:
        from ..linear_model import LinearRegression

        self.regressor_ = LinearRegression()
    else:
        self.regressor_ = clone(self.regressor)

    if sample_weight is None:
        self.regressor_.fit(X, y_trans)
    else:
        self.regressor_.fit(X, y_trans, sample_weight=sample_weight)

    return self


# Traceback (ValueError)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-7-366d815659ba> in <module>()
----> 1 clf_trans.fit(df[use_col], y, sample_weight=df['sample_weight'])

~/anaconda3/envs/test_env/lib/python3.5/site-packages/sklearn/compose/_target.py in fit(self, X, y, sample_weight)
194             self.regressor_.fit(X, y_trans)
195         else:
--> 196             self.regressor_.fit(X, y_trans, sample_weight=sample_weight)
197
198         return self

~/anaconda3/envs/test_env/lib/python3.5/site-packages/sklearn/pipeline.py in fit(self, X, y, **fit_params)
263             This estimator
264         """
--> 265         Xt, fit_params = self._fit(X, y, **fit_params)
266         if self._final_estimator is not None:
267             self._final_estimator.fit(Xt, y, **fit_params)

~/anaconda3/envs/test_env/lib/python3.5/site-packages/sklearn/pipeline.py in _fit(self, X, y, **fit_params)
200                                 if step is not None)
201         for pname, pval in six.iteritems(fit_params):
--> 202             step, param = pname.split('__', 1)
203             fit_params_steps[step][param] = pval
204         Xt = X

ValueError: not enough values to unpack (expected 2, got 1)

# Fixed code
def fit(self, X, y, **fit_params):
    """Fit the model according to the given training data.

    Parameters
    ----------
    X : {array-like, sparse matrix}, shape (n_samples, n_features)
        Training vector, where n_samples is the number of samples and
        n_features is the number of features.

    y : array-like, shape (n_samples,)
        Target values.

    **fit_params : dict of string -> object
        Parameters passed to the ``fit`` method of the underlying
        regressor.


    Returns
    -------
    self : object
    """
    y = check_array(
        y, accept_sparse=False, force_all_finite=True, ensure_2d=False, dtype="numeric"
    )

    # store the number of dimension of the target to predict an array of
    # similar shape at predict
    self._training_dim = y.ndim

    # transformers are designed to modify X which is 2d dimensional, we
    # need to modify y accordingly.
    if y.ndim == 1:
        y_2d = y.reshape(-1, 1)
    else:
        y_2d = y
    self._fit_transformer(y_2d)

    # transform y and convert back to 1d array if needed
    y_trans = self.transformer_.transform(y_2d)
    # FIXME: a FunctionTransformer can return a 1D array even when validate
    # is set to True. Therefore, we need to check the number of dimension
    # first.
    if y_trans.ndim == 2 and y_trans.shape[1] == 1:
        y_trans = y_trans.squeeze(axis=1)

    if self.regressor is None:
        from ..linear_model import LinearRegression

        self.regressor_ = LinearRegression()
    else:
        self.regressor_ = clone(self.regressor)

    self.regressor_.fit(X, y_trans, **fit_params)

    return self