简体   繁体   中英

threshold must be numeric and non-NAN, When printing numpy array, Why numpy.nan is undefined in python3

Im trying to print all the values of a matrix in python2 by

import numpy as np
np.set_printoptions(threshold=np.nan)
print myMatrix

but its giving me the error threshold must be numeric and non-NAN

In python3 I can print the array by

import sys
numpy.set_printoptions(threshold=sys.maxsize)
print(myMatrix)

But why numpy.nan isn't working in python3

nunmpy.nan was never supposed to be supported . This is why it doesn't work in python 3

正确的是: np.set_printoptions(threshold=np.inf, linewidth=np.nan)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM