¡@

Home 

python Programming Glossary: array.shape

Iterating over a numpy array

http://stackoverflow.com/questions/6967463/iterating-over-a-numpy-array

there a less verbose alternative to this for x in xrange array.shape 0 for y in xrange array.shape 1 do_stuff x y I came up with.. to this for x in xrange array.shape 0 for y in xrange array.shape 1 do_stuff x y I came up with this for x y in itertools.product.. came up with this for x y in itertools.product map xrange array.shape do_stuff x y Which saves one indentation but is still pretty..

Numpy vs Cython speed

http://stackoverflow.com/questions/7799977/numpy-vs-cython-speed

without cython import numpy as np def _process array rows array.shape 0 cols array.shape 1 out np.zeros rows cols for row in range.. numpy as np def _process array rows array.shape 0 cols array.shape 1 out np.zeros rows cols for row in range 0 rows out row np.sum.. np.ndarray DTYPE_t ndim 2 array cdef unsigned int rows array.shape 0 cdef unsigned int cols array.shape 1 cdef unsigned int row..