[Numpy-discussion] shortcut nonzero?

Alan G Isaac alan.isaac at gmail.com
Tue Feb 25 14:20:22 EST 2014


Is there a shortcut version for finding the first (k) instance(s) of nonzero entries?
I'm thinking of Matlab's `find(X,k)`:
http://www.mathworks.com/help/matlab/ref/find.html
Easy enough to write of course.

I thought `flatnonzero` would be the obvious place for this,
but it does not have a `first=k` option.
Is such an option worth suggesting?

Thanks,
Alan Isaac



More information about the NumPy-Discussion mailing list