+ 1
It is three dimensional array im creating but it shows it 2 dimensional array. Anybody explain?
import numpy as np my_arr = np.array([[1,2,3,4,5],[6,7,8,9,10],[12,32,34,56,321]]) #crearing a array with numpy print(my_arr) #creating a dimension of array print(my_arr.ndim)
3 ответов
+ 1
You‘re missing another [ ] arround the arra (it needs three levels for beinf 3d, as far as i know).
+ 2
# Hi! You can take a look at this one:
import numpy as np
my432 = np.array([
[[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]],
[[13, 14, 15, 16],
[17, 18, 19, 20],
[21, 22, 23, 24]]
])
print(my432)
print(f"\n{my432.ndim = }")
+ 1
Thank you guys