# Buggy code
def reweight_covariance(self, data):
    """Re-weight raw Minimum Covariance Determinant estimates.

    Re-weight observations using Rousseeuw's method (equivalent to
    deleting outlying observations from the data set before
    computing location and covariance estimates). [Rouseeuw1984]_

    Parameters
    ----------
    data : array-like, shape (n_samples, n_features)
        The data matrix, with p features and n samples.
        The data set must be the one which was used to compute
        the raw estimates.

    Returns
    -------
    location_reweighted : array-like, shape (n_features, )
        Re-weighted robust location estimate.

    covariance_reweighted : array-like, shape (n_features, n_features)
        Re-weighted robust covariance estimate.

    support_reweighted : array-like, type boolean, shape (n_samples,)
        A mask of the observations that have been used to compute
        the re-weighted robust location and covariance estimates.

    """
    n_samples, n_features = data.shape
    mask = self.dist_ < chi2(n_features).isf(0.025)
    if self.assume_centered:
        location_reweighted = np.zeros(n_features)
    else:
        location_reweighted = data[mask].mean(0)
    covariance_reweighted = self._nonrobust_covariance(
        data[mask], assume_centered=self.assume_centered
    )
    support_reweighted = np.zeros(n_samples).astype(bool)
    support_reweighted[mask] = True
    self._set_covariance(covariance_reweighted)
    self.location_ = location_reweighted
    self.support_ = support_reweighted
    X_centered = data - self.location_
    self.dist_ = np.sum(np.dot(X_centered, self.get_precision()) * X_centered, 1)
    return location_reweighted, covariance_reweighted, support_reweighted


# Traceback (IndexError)
======================================================================
ERROR: sklearn.tests.test_common.test_regressors_train('RANSACRegressor', <class 'sklearn.linear_model.ransac.RANSACRegr
essor'>, array([[-0.44836249, -0.47282444, -1.20608008, ..., -0.75500806,
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\nose\case.py", line 197, in runTest
self.test(*self.arg)
File "C:\Python27\lib\site-packages\sklearn\tests\test_common.py", line 850, in check_regressors_train
assert_raises(ValueError, regressor.fit, X, y[:-1])
File "C:\Python27\lib\unittest\case.py", line 473, in assertRaises
callableObj(*args, **kwargs)
File "C:\Python27\lib\site-packages\sklearn\linear_model\ransac.py", line 261, in fit
y_subset = y[subset_idxs]
IndexError: index 199 is out of bounds for axis 0 with size 199

# Fixed code
def reweight_covariance(self, data):
    """Re-weight raw Minimum Covariance Determinant estimates.

    Re-weight observations using Rousseeuw's method (equivalent to
    deleting outlying observations from the data set before
    computing location and covariance estimates). [Rouseeuw1984]_

    Parameters
    ----------
    data : array-like, shape (n_samples, n_features)
        The data matrix, with p features and n samples.
        The data set must be the one which was used to compute
        the raw estimates.

    Returns
    -------
    location_reweighted : array-like, shape (n_features, )
        Re-weighted robust location estimate.

    covariance_reweighted : array-like, shape (n_features, n_features)
        Re-weighted robust covariance estimate.

    support_reweighted : array-like, type boolean, shape (n_samples,)
        A mask of the observations that have been used to compute
        the re-weighted robust location and covariance estimates.

    """
    n_samples, n_features = data.shape
    mask = self.dist_ < chi2(n_features).isf(0.025)
    if self.assume_centered:
        location_reweighted = np.zeros(n_features)
    else:
        location_reweighted = data[mask].mean(0)
    covariance_reweighted = self._nonrobust_covariance(
        data[mask], assume_centered=self.assume_centered
    )
    support_reweighted = np.zeros(n_samples, dtype=bool)
    support_reweighted[mask] = True
    self._set_covariance(covariance_reweighted)
    self.location_ = location_reweighted
    self.support_ = support_reweighted
    X_centered = data - self.location_
    self.dist_ = np.sum(np.dot(X_centered, self.get_precision()) * X_centered, 1)
    return location_reweighted, covariance_reweighted, support_reweighted