I know that this has probably been asked before, but in all of the questions i am looking, they are talking about a different type of reshaping.
Let's say that we have the following numpy arrays:
data1 = np.array([[[12], [13]], [[14], [15]], [[16], [17]]])
data2 = np.array([[[22], [23]], [[24], [25]], [[26], [27]]])
data3 = np.array([[[32], [33]], [[34], [35]], [[36], [37]]])
data4 = np.array([[[42], [43]], [[44], [45]], [[46], [47]]])
with a shape of (3, 2, 1)
How can we combine these four arrays so we can get the following shape (3, 2, 4)
result = np.array([[[12, 22, 32, 42], [13, 23, 33, 43]], [[14, 24, 34, 44], [15, 25, 35, 45]], [[16, 26, 36, 46], [17, 27, 36, 47]]])
您可以使用np.concatenate()
:
np.concatenate((data1, data2, data3, data4), axis=2)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.