[Numpy-discussion] np.nonzero - order guarantees?

Sebastian Berg sebastian at sipsolutions.net
Tue Jul 28 11:45:07 EDT 2015


Yes, I think it is guaranteed C order in the results.


On Mon Jul 27 14:05:01 2015 GMT+0200, Matthew Brett wrote:
> Hi,
> 
> `np.nonzero` for a 2D array `A` returns:
> 
> row_inds, col_inds = np.nonzero(A)
> 
> I notice that `row_inds` appears to be sorted by value, and `col_inds`
> appears to be sorted by value, within each row.
> 
> Is this a guarantee of the `np.nonzero` function?  If not, does this
> function guarantee any property of the returned indices, other than
> the correspondence of the row, column entries?
> 
> Cheers,
> 
> Matthew
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
>


More information about the NumPy-Discussion mailing list