[Numpy-discussion] The meaning of threshold in numpy.set_printoptions()?

Eric Wieser wieser.eric+numpy at gmail.com
Mon Dec 11 22:44:06 EST 2017


Whether summarization happens is also determined by edgeitems (defaults to
3), which is the number of items to print on each edge when summarizing.

It wouldn’t make sense for summarization to cause the output to be longer
than if no summarization occured!

Feel free to submit an improvement to the documentation there on github.

Eric
​

On Mon, 11 Dec 2017 at 19:40 Peng Yu <pengyu.ut at gmail.com> wrote:

> Hi,
>
> The help says.
>
>     threshold : int, optional
>         Total number of array elements which trigger summarization
>         rather than full repr (default 1000).
>
> But the following code shows that 7 triggers summarization instead of
> 5. Does anybody know how to interpret the meaning of `threshold`?
> Thanks.
>
> In [1]: import numpy as np
>    ...: np.set_printoptions(threshold=5)
>    ...: print(np.arange(6))
>    ...: print(np.arange(7))
>    ...:
> [0 1 2 3 4 5]
> [0 1 2 ..., 4 5 6]
>
> --
> Regards,
> Peng
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20171212/e147c71c/attachment.html>


More information about the NumPy-Discussion mailing list