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]])
np.inf
?np.nan
and'nan'
only work by total fluke, and'nan'
doesn't even work in Python 3 because they changed the mixed-type comparison implementation thatthreshold='nan'
depended on. – user2357112 supports Monicathreshold=np.nan
rather than'nan'
depends on a different fluke, which is that the array printing logic compares the array size to the threshold witha.size > _summaryThreshold
. This always returnsFalse
for_summaryThreshold=np.nan
. If the comparison had beena.size <= _summaryThreshold
, testing whether the array should be fully printed instead of testing whether it should be summarized, this threshold would trigger summarization for all arrays.) – user2357112 supports Monicatmp
justlist(tmp)
. Other options with different formatting aretmp.tolist()
or for more controlprint("\n".join(str(x) for x in tmp))
. – travc