np.append, ( ). . :
arr , . , append : . None, out - .
( 3 , , , )
, 3 , :
import numpy as np
a = np.array([[ 1., 1., 1.],
[ 1., 1., 1.],
[ 1., 1., 1.]])
b = np.array([[ 88., 42.5, 9. ],
[ 121.5, 76., 42.5],
[ 167., 121.5, 88. ]])
c = np.array([[ 88., 42.5, 13. ],
[ 117.5, 72., 42.5],
[ 163., 117.5, 88. ]])
result = np.empty((3,3), dtype=object)
n, p = result.shape
for i in range(n):
result[i, 0] = a[i,:]
result[i, 1] = b[i,:]
result[i, 2] = c[i,:]
print(result)
:
array([[array([ 1., 1., 1.]), array([ 88. , 42.5, 9. ]),
array([ 88. , 42.5, 13. ])],
[array([ 1., 1., 1.]), array([ 121.5, 76. , 42.5]),
array([ 117.5, 72. , 42.5])],
[array([ 1., 1., 1.]), array([ 167. , 121.5, 88. ]),
array([ 163. , 117.5, 88. ])]], dtype=object)
list np.array :
n, p = result.shape
for i in range(n):
result[i, 0] = a[i,:].tolist()
result[i, 1] = b[i,:].tolist()
result[i, 2] = c[i,:].tolist()
print(result)
:
[[[1.0, 1.0, 1.0] [88.0, 42.5, 9.0] [88.0, 42.5, 13.0]]
[[1.0, 1.0, 1.0] [121.5, 76.0, 42.5] [117.5, 72.0, 42.5]]
[[1.0, 1.0, 1.0] [167.0, 121.5, 88.0] [163.0, 117.5, 88.0]]]
2D-, 1D-.
3D- (3,3,3) :
np.stack([a,b,c])