打印完整numpy的数组 [英] Print the full numpy array

查看:4830
本文介绍了打印完整numpy的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打印numpy的数组,我得到一个重新被截断presentation,但我想的全阵列。

有没有办法做到这一点?

例子:

 >>> numpy.arange(10000)
阵列([0,1,2,...,9997,9998,9999])
>>> numpy.arange(10000).reshape(250,40)
阵列([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的
numpy.set_printoptions(阈值= numpy.nan)

请注意,由于上面给出的应答可与从numpy的进口*,这是不可取的初始。
这也为我的作品

  numpy.set_printoptions(阈值='男')

有关完整文档,请参阅http://docs.scipy.org/doc/numpy/reference/generated/numpy.set_printoptions.html.

When I print a numpy array, I get a truncated representation, but I want the full array.

Is there any way to do this?

Examples:

>>> 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]])

解决方案

To clarify on Reed's reply

import numpy
numpy.set_printoptions(threshold=numpy.nan)

Note that the reply as given above works with an initial 'from numpy import *', which is not advisable. This also works for me

numpy.set_printoptions(threshold='nan')

For full documentation, see http://docs.scipy.org/doc/numpy/reference/generated/numpy.set_printoptions.html.

这篇关于打印完整numpy的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆