How to print full array in Numpy?

Learn how to display full NumPy arrays without truncation using np.set_printoptions() with threshold parameter.

Numpy full print array

NumPy truncates arrays larger than default threshold (1000 elements); shows first/last elements with “…” in middle.

Numpy print array

Setting threshold to print full array

There is a clever way to print the full array. To do that, you need to increase the np.set_printoptions threshold. To be sure the threshold will be enough, just set it as the size of your array. This is the optimal solution. 

import numpy as np

my_array = np.arange(10000).reshape(10, -1)

np.set_printoptions(threshold=np.size(my_array))

print(f"My fully printed array: \n {my_array}")

Using an infinity to print full array

Using threshold=np.inf disables truncation entirely; works for arrays of any size but may impact performance with extremely large arrays.

import numpy as np

my_array = np.arange(10000).reshape(10, -1)

np.set_printoptions(threshold=np.inf)

print(f"My fully printed array: \n {my_array}")

See also  How to use Numpy genfromtxt function?