Printing NumPy Array. The following codes show how to print an array of Python NumPy Module. I used Jupyter Notebook.
Code:
import numpy as np
Code:
a = np.arange(6)
print(a)
Output:
[0 1 2 3 4 5]
Code:
b = np.arange(12).reshape(4,3)
print(b)
Output:
[[ 0 1 2]
[ 3 4 5]
[ 6 7 8]
[ 9 10 11]]
Code:
c = np.arange(24).reshape(2,3,4)
print(c)
Output:
[[[ 0 1 2 3]
[ 4 5 6 7]
[ 8 9 10 11]]
[[12 13 14 15]
[16 17 18 19]
[20 21 22 23]]]
Code:
print(np.arange(10000))
Output:
[ 0 1 2 ..., 9997 9998 9999]
Code:
print(np.arange(10000).reshape(100,100))
Output:
[[ 0 1 2 ..., 97 98 99]
[ 100 101 102 ..., 197 198 199]
[ 200 201 202 ..., 297 298 299]
...,
[9700 9701 9702 ..., 9797 9798 9799]
[9800 9801 9802 ..., 9897 9898 9899]
[9900 9901 9902 ..., 9997 9998 9999]]