This commit is contained in:
2024-06-03 15:00:59 +08:00
parent 756ff95c0b
commit cd876316e2
2 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
"""
This code is supported by the website: https://www.guanjihuan.com
The newest version of this code is on the web page: https://www.guanjihuan.com/archives/41194
"""
import numpy as np
a = np.random.rand(2, 3)
b = np.random.rand(2, 3)
# 第一维度的数据合并(需要其他的维度保持一致)
concatenated_1 = np.concatenate((a, b), axis=0)
print(concatenated_1.shape)
# 第二维度的数据合并(需要其他的维度保持一致)
concatenated_2 = np.concatenate((a, b), axis=1)
print(concatenated_2.shape)