From: Michael M. F. <mf...@ph...> - 2006-10-25 05:35:21
|
Could someone please explain the semantics of the following. >>> from numpy import * >>> a1 = array([1,2,3]) >>> a2 = array([[1,2,3]]) >>> a1[where(a1==3)],a2[where(a2==3)] (array([3]), 3) Why are 1-dimensional fundamentally different than N-dimensional arrays in this regard? When there is a single match, N-d arrays always return a scalar whereas 1-d arrays return an array. Is this a bug? Thanks, Michael. |