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.
By default, NumPy will truncate the display of large arrays.
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}")