3d array in python numpy code example
Example 1: 3d array in numpy
>>> a = np.zeros((2, 3, 4))
>>> a
array([[[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.]],
[[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.]]])
Example 2: python 3d array
Explaination:
import numpy as np
np.zeros(the amount of arrays, amount of rows, the amount of colums)
---------------------------------------------------------------------
Usage:
array_city = np.zeros((2, 3, 4))
print(array_city)
---------------------------------------------------------------------
Results:
[
[
[0. 0. 0. 0.],
[0. 0. 0. 0.],
[0. 0. 0. 0.],
],
[
[0. 0. 0. 0.],
[0. 0. 0. 0.],
[0. 0. 0. 0.],
]
]