>> 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
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
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,