0

Let's say I have a .dat file and try to print its first column using this code:

import numpy as np
data = np.loadtxt('d.dat', dtype='str')
a=data[:, 1]
print(a)

Now, when number of data is around 500, it prints all data. But for 5,000 numbers of data, it prints like this:

a=['1' '2' '3' .......'9' '10']

Now my question is how to print for large numbers of data like this:

a=['1' '2' '3' '4' '5' '6' '7' '8' '9' '10']
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
sd_Dhara.45
  • 101
  • 3

1 Answers1

1

Solution from post: Print all columns and rows of a numpy array:

See the docs on print options. Specifically:

threshold : int, optional

Total number of array elements which trigger summarization rather than full repr (default 1000).

So setting threshold to np.inf means it is never summarized. np.set_printoptions(threshold=np.inf)

Ingumeta
  • 51
  • 1
  • 8