Re: numpy array product driving me mad

2015-03-20 Thread Mr. Twister
>> I think that you want >> >> P * R[;,None] > > Sorry, I meant > > P * R[:, None] > > Manolo Muchísimas gracias, Manolo. Eres un genio y me has ayudado mucho. Te debo una. -- https://mail.python.org/mailman/listinfo/python-list

Re: numpy array product driving me mad

2015-03-20 Thread Manolo Martínez
On 03/20/15 at 02:11pm, Manolo Martínez wrote: > On 03/20/15 at 01:46pm, Mr. Twister wrote: > > > I have two numpy arrays: [...] > > Is there a direct, single expression command to get this result? > > I think that you want > > P * R[;,None] Sorry, I meant P * R[:, None] Manolo

Re: numpy array product driving me mad

2015-03-20 Thread Manolo Martínez
On 03/20/15 at 01:46pm, Mr. Twister wrote: > I have two numpy arrays: > > >>> P > array([[[ 2, 3], > [33, 44], > [22, 11], > [ 1, 2]]]) > >>> R > array([0, 1, 2, 3]) > > the values of these may of course be different. The important fact is that: > > >>> P.shape > (1,

numpy array product driving me mad

2015-03-20 Thread Mr. Twister
Hi everyone. Hope you can help me overcome this "noob" issue. I have two numpy arrays: >>> P array([[[ 2, 3], [33, 44], [22, 11], [ 1, 2]]]) >>> R array([0, 1, 2, 3]) the values of these may of course be different. The important fact is that: >>> P.shape (1, 4, 2) >>>