[Numpy-discussion] (no subject)
Marcel Blattner
blattnem at gmail.com
Thu Mar 3 08:54:28 EST 2011
...for example:
A = np.random.rand(5,5)
In [366]: A
Out[366]:
array([[ 0.36380049, 0.26440478, 0.8515609 , 0.07893608, 0.48084575],
[ 0.71133527, 0.90912083, 0.14812865, 0.23223621, 0.49983985],
[ 0.51668793, 0.73303799, 0.18620246, 0.52968823, 0.51904697],
[ 0.3988893 , 0.60350318, 0.63808109, 0.38470785, 0.48923821],
[ 0.02427049, 0.80382225, 0.42494655, 0.8986108 , 0.39879547]])
In [367]: np.nonzero(A==np.min(A))
Out[367]: (array([4]), array([0]))
And this may be of interest for you:
http://www.scipy.org/NumPy_for_Matlab_Users
cheers
Marcel
On Wed, Mar 2, 2011 at 11:25 PM, Alex Ter-Sarkissov <ater1980 at gmail.com>wrote:
> hi, the question is probably very silly, but can't get my head around it
>
> Say I have an NxM numerical array. What I want is to obtain the row and
> column number of the smallest value(kinda like find command in Matlab). I
> use something like where(min(array_name)), but keep getting the error
> message. I'd be glad if any1 could have any suggestions in this regard.
>
> cheers,
>
> Alex
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110303/f4af53ee/attachment.html>
More information about the NumPy-Discussion
mailing list