How do I print the full NumPy array, without truncation?

To print the full NumPy array without truncation, you can use the numpy.set_printoptions() function and set the threshold parameter to np.inf. Here is an example code snippet:

import numpy as np

# Create an example array
arr = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

# Set print options to display full array
np.set_printoptions(threshold=np.inf)

# Print the full array
print(arr)

This will print the entire array without any truncation.

Watch a course Python - The Practical Guide

You can also use np.set_printoptions(threshold=np.inf, suppress=True) to print the entire array without scientific notation.

You can also use np.set_printoptions(threshold=np.inf, suppress=True, linewidth=np.inf) to print the entire array without scientific notation, and without line-wrapping.