当我打印一个 numpy 数组时,我得到一个截断的表示,但我想要完整的数组。
有没有办法做到这一点?
例子:
>>> numpy.arange(10000) array([ 0, 1, 2, ..., 9997, 9998, 9999]) >>> numpy.arange(10000).reshape(250,40) array([[ 0, 1, 2, ..., 37, 38, 39], [ 40, 41, 42, ..., 77, 78, 79], [ 80, 81, 82, ..., 117, 118, 119], ..., [9880, 9881, 9882, ..., 9917, 9918, 9919], [9920, 9921, 9922, ..., 9957, 9958, 9959], [9960, 9961, 9962, ..., 9997, 9998, 9999]])
使用numpy.set_printoptions:
numpy.set_printoptions
import sys import numpy numpy.set_printoptions(threshold=sys.maxsize)