I have some problem about 3D python numpy
import numpy as np
n = 5
m = 4
Sc = np.random.rand(m,n,n)
S1 = np.zeros((1,n+2))
S2 = np.zeros((n,1))
A0 = np.r_[S1, np.c_[S2, Sc[0], S2], S1]
A1 = np.r_[S1, np.c_[S2, Sc[1], S2], S1]
#print(A)
#print(B)
A = np.array([A0,A1])
A.shape
Atmp = np.r_[S1, np.c_[S2, Sc[2], S2], S1]
Dimension of A = (2, 7, 7)
and dimension of Atmp = (7,7).
How to append Atmp to A ?
Atmp + Adoesn't give any errors for me. MaybeA += Atmp? You need to clarify exactly what you want.A = np.array((A0, A1, Atmp))orA = np.vstack((A, Atmp[None,...]))np.appendis another way of usingnp.concatenate, and often a confusing one.np.r_andnp.c_are alsoconcatenatefrontends.