我正在尝试打印两个 1001x1 数组的完整内容,但 Python 只给我截断的输出,如下所示:
array([[5,45],
[1,23],
......,
[1,24],
[2,31]])
而不是完整的数组。
任何人都可以给我如何获得完整的 1001x1 阵列的解决方案吗?
最佳答案
参见 Printing Arrays 部分在 NumPy 教程中:
If an array is too large to be printed, NumPy automatically skips the central part of the array and only prints the corners:
>>> print(np.arange(10000)) [ 0 1 2 ..., 9997 9998 9999]
...
To disable this behaviour and force NumPy to print the entire array, you can change the printing options using set_printoptions.
>>> np.set_printoptions(threshold=nan)
np.set_printoptions
函数是 NumPy 库的一部分。
关于python - 长的 NumPy 数组无法完全打印?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4528612/