On 07/25/2013 01:11 PM, Gael Varoquaux wrote:
>
> In sklearn/preprocessing.py:
>
> > +                                                   self.axis)
> > +
> > +        return self
> > +
> > +    def _sparse_fit(self, X, strategy, missing_values, axis):
> > +        """Fit the transformer on sparse data."""
> > +        # Imputation is done "by column", so if we want to do it
> > +        # by row we only need to convert the matrix to csr format.
> > +        if axis == 1:
> > +            X = X.tocsr()
> > +        else:
> > +            X = X.tocsc()
> > +
> > +        # Count the zeros
> > +        if missing_values == 0:
> > +            n_zeros = np.zeros(X.shape[not axis])
> maybe I'd use 1 - axis to make the intent more clear. I'm not entirely 
> sure why this is working now actually. Isn't the not returning a bool?
> Yes, but bools get cast to 0 or 1
>
Why? because it is indexing a tuple not an array? That is subtle business.