Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
939 views
in Technique[技术] by (71.8m points)

numpy - Python prints "..." in very large output

I am trying to print something big in python and instead of getting the whole result i get parts of it with "..." in the middle. Any ideas how to get the whole of it?

e.g.

'8.881386032' '5.737972827' '3.355746972' ..., '2.827335059', '2.598858336' '2.69954686'

The code is:

 transposedMatrix = np.transpose(data)
 print (transposedMatrix)

I am already converting it into a string and i get the same thing when i am writing in files

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

For numpy, call:

import sys
import numpy

numpy.set_printoptions(threshold=sys.maxint)

to raise the threshold to infinity. See the numpy.set_printoptions() documentation for more details.

For Python 3, use sys.maxsize instead:

numpy.set_printoptions(threshold=sys.maxsize)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...