Re: [Tutor] summing arrays, along a dimension

2007-09-14 Thread bob gailer
John wrote: > >>> d > array([[0, 0, 1], >[1, 2, 3], >[2, 2, 4], >[3, 6, 8]]) > >>> e=reshape((d[:,-2]+d[:,-1]),(4,1)) > >>> e > array([[ 1], >[ 5], >[ 6], >[14]]) > > is there a better way to accomplish this? Which module are you using? In APL we'd

Re: [Tutor] summing arrays, along a dimension

2007-09-14 Thread Alan Gauld
"John" <[EMAIL PROTECTED]> wrote d > array([[0, 0, 1], > [1, 2, 3], > [2, 2, 4], > [3, 6, 8]]) e=reshape((d[:,-2]+d[:,-1]),(4,1)) e > array([[ 1], > [ 5], > [ 6], > [14]]) > > is there a better way to accomplish this? Better? Maybe. More reada

Re: [Tutor] summing arrays, along a dimension

2007-09-14 Thread Ricardo Aráoz
John wrote: d > array([[0, 0, 1], >[1, 2, 3], >[2, 2, 4], >[3, 6, 8]]) e=reshape((d[:,-2]+d[:,-1]),(4,1)) e > array([[ 1], >[ 5], >[ 6], >[14]]) > > is there a better way to accomplish this? > >>> d [[0, 0, 1], [1, 2, 3], [2, 2, 4],

[Tutor] summing arrays, along a dimension

2007-09-14 Thread John
>>> d array([[0, 0, 1], [1, 2, 3], [2, 2, 4], [3, 6, 8]]) >>> e=reshape((d[:,-2]+d[:,-1]),(4,1)) >>> e array([[ 1], [ 5], [ 6], [14]]) is there a better way to accomplish this? ___ Tutor maillist - Tutor@python