How to print full array in Numpy?

Let’s learn how to print the full array in the Numpy Python library. We are going to use a clever way to do that.
Numpy full print array

By default, NumPy will truncate the display of large arrays.

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

The alternative method is to use np.set_printoptions(threshold=np.inf), which is positive infinity.

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  Correlation between arrays in Numpy