Skip to content
This repository

set_printoptions with threshold as "nan" bug #2752

Closed
Panoplos opened this Issue · 4 comments

4 participants

Panoplos Charles Harris njsmith pjh
Panoplos

According to the numpy docs, if you want to disable summary printing for ndarray, you call set_printoptions(threshold="nan"), but this results in the following error when doing the print:

File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/numpy/core/arrayprint.py", line 240, in _array2string
    if a.size > _summaryThreshold:
TypeError: unorderable types: int() > str()

Line 240 of arrayprint.py should be changed to:

if _summaryThreshold != "nan" and a.size > _summaryThreshold:
njsmith
Owner
Panoplos

You are correct. This worked.

pjh
pjh commented

I also encountered this problem today. I tried to edit the wiki page at http://www.scipy.org/Tentative_NumPy_Tutorial, but I got 500 server errors twice when I tried to create an account. That tutorial page still shows this as an example:

>>> set_printoptions(threshold='nan')

I guess it should show:

>>> set_printoptions(threshold=nan)

or (this worked for me):

>>> set_printoptions(threshold=numpy.nan)
Charles Harris
Owner

Looks like the Wiki is closed for editing, so closing this.

Charles Harris charris closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.