[Numpy-discussion] Broadcasting rules (Ticket 76).

Sasha ndarray at mac.com
Mon Apr 24 11:30:05 EDT 2006


On 4/24/06, Zachary Pincus <zpincus at stanford.edu> wrote:
> [...]
> In [5]: print a.shape, means.shape
> (50, 100) (50,)
> In [5]: a / means
> ValueError: index objects are not broadcastable to a single shape
> In [6]: (a.transpose() / means).transpose()
> #this works

This works too:
>>> x = a / means[:,newaxis]

no .transpose() :-).




More information about the NumPy-Discussion mailing list