1>>> import numpy as np
2>>> a = np.array([0, 1, 2, 3])
3>>> a
4array([0, 1, 2, 3])
5
1>>> np.zeros( (3,4) )
2array([[ 0., 0., 0., 0.],
3 [ 0., 0., 0., 0.],
4 [ 0., 0., 0., 0.]])
5>>> np.ones( (2,3,4), dtype=np.int16 ) # dtype can also be specified
6array([[[ 1, 1, 1, 1],
7 [ 1, 1, 1, 1],
8 [ 1, 1, 1, 1]],
9 [[ 1, 1, 1, 1],
10 [ 1, 1, 1, 1],
11 [ 1, 1, 1, 1]]], dtype=int16)
12>>> np.empty( (2,3) ) # uninitialized, output may vary
13array([[ 3.73603959e-262, 6.02658058e-154, 6.55490914e-260],
14 [ 5.30498948e-313, 3.14673309e-307, 1.00000000e+000]])
15