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

Pierre GM pgmdevlist@gmail....
Mon Apr 23 10:53:57 CDT 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