quickly looping over a 2D array?
robert.kern at gmail.com
Mon Jul 27 12:11:02 EDT 2009
On 2009-07-27 06:24, Martin wrote:
> I am new to python and I was wondering if there was a way to speed up
> the way I index 2D arrays when I need to check two arrays
> simultaneously? My current implementations is (using numpy) something
> like the following...
> for i in range(numrows):
> for j in range(numcols):
> if array_1[i, j] == some_value or array_2[i, j]>= array_1[i,
> j] * some_other_value
> array_1[i, j] = some_new_value
Peter has given you good answers, but you will probably want to ask future numpy
questions on the numpy mailing list.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list