[Numpy-discussion] get information/position of value from matrix

josef.pktd@gmai... josef.pktd@gmai...
Wed Apr 7 10:10:40 CDT 2010


On Wed, Apr 7, 2010 at 11:15 AM, Michael Gilbert
<michael.s.gilbert@gmail.com> wrote:
> On Wed, 7 Apr 2010 16:40:24 +0200, ioannis syntychakis wrote:
>> Hallo Everybody,
>>
>> I am new in this mail list and python. But I am working at something and I
>> need your help.
>>
>> I have a very big matrix. What I want is to search in that matrix for values
>> above the (for example:) 150. If there are values above the 150, I also want
>> to get their position and value.
>
> a[a>150]
>
>> Is this possible?
>> Thanks in advance!!
>>
>> ps. could you also tell me how i can show the whole matrix? because now i
>> see:
>
> i use a small routine for this.  i just walk through each element, and
> print it with sys.stdout.write, which doesn't automatically add
> end-of-lines.

I think threshold keyword allows to change the default for this

numpy.set_printoptions(precision=None, threshold=None, edgeitems=None,
linewidth=None, suppress=None, nanstr=None, infstr=None)

threshold : int, optional
      Total number of array elements which trigger summarization
rather than full repr (default 1000).

Josef

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


More information about the NumPy-Discussion mailing list