Re: [Numpy-discussion] A proposed change to rollaxis() behavior for negative 'start' values

2013-02-15 Thread Thomas Coffee
Adding to an old discussion thread (see below) ... an implementation of the proposed functionality: from numpy import rollaxis def moveaxis(a, i, j = 0): """ move axis i of array a to position j """ n = a.ndim i = i if i >= 0 else i + n if j > i: return rollaxis(a,

Re: [Numpy-discussion] Baffling TypeError using fromfunction with explicit cast

2011-12-24 Thread Thomas Coffee
, 2011 at 7:46 PM, Thomas Coffee wrote: > Somewhat new to NumPy, but I've been investigating this for over an hour > and found nothing helpful: > > Can anyone explain why this works ... > > > >>> import numpy > >>> numpy.fromfunction(lambda i, j: i*j,

[Numpy-discussion] Baffling TypeError using fromfunction with explicit cast

2011-12-24 Thread Thomas Coffee
Somewhat new to NumPy, but I've been investigating this for over an hour and found nothing helpful: Can anyone explain why this works ... >>> import numpy >>> numpy.fromfunction(lambda i, j: i*j, (3,4)) array([[ 0., 0., 0., 0.], [ 0., 1., 2., 3.], [ 0., 2., 4., 6.]]) ...