On 2015/02/08 12:43 PM, josef.p...@gmail.com wrote:

>
> For me the main behavior I had to adjust to was loosing a dimension in
> any reduce operation, mean, sum, ...
>
> if x is 2d
> x - x.mean(1)
> we loose a dimension, and it doesn't broadcast in the right direction

Though you can use:

x_demeaned = x - np.mean(x, axis=1, keepdims=True)

>
> x - x.mean(0)
> perfect, no `repeat` needed, it just broadcasts the way we need.
>
> Josef

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to