打印 numpy 数组的所有列和行 [英] Print all columns and rows of a numpy array
本文介绍了打印 numpy 数组的所有列和行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如截图所示,二维 numpy
数组被截断用于打印目的.我想显示所有元素.是否有启用该行为的选项设置?
As shown in the screenshot a 2D numpy
array is truncated for printing purposes. I would like to have all elements displayed. Is there an option setting to enable that behavior?
推荐答案
参见 有关打印选项的文档.具体:
阈值:整数,可选
触发汇总而不是完整repr的数组元素总数(默认为1000).
Total number of array elements which trigger summarization rather than full repr (default 1000).
因此将 threshold
设置为 np.inf
意味着它永远不会被汇总.
So setting threshold
to np.inf
means it is never summarized.
np.set_printoptions(threshold=np.inf)
这篇关于打印 numpy 数组的所有列和行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文