[Numpy-discussion] efficient use of numpy.where() and .any()

Pierre GM pgmdevlist at gmail.com
Mon Apr 23 11:53:57 EDT 2007


Oh, I pressed "send" too early.
Just an addition:
numpy.where creates a new array from some condition. If you only want to 
change elements of an existing array that satisfies a given condition, 
indexing is far more efficient: no temporary is created. Hence the suggestion 
of 
a[a<0]



More information about the NumPy-Discussion mailing list