Print Array in Numpy


NumPy - Print Array

To print given numpy array in Python, we can use Python builtin function print().

Pass the given array as argument to the print() function.

Example

In the following program, we take a numpy array in arr, and print it to standard output.

Python Program

import numpy as np

arr = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])

print(arr)

Output

[[ 1  2  3  4]
 [ 5  6  7  8]
 [ 9 10 11 12]]

Summary

In this NumPy Tutorial, we learned how to print a given numpy array in Python using builtin print() function.