目录
一、hstack()
二、vatack()
一、hstack()
#vertical stack (类似于垂直合并)
import numpy as np
a = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
b = np.array([[1, 2, 9, 10], [5, 6, 7, 8]])
a
>>>
[[1 2 3 4]
[5 6 7 8]]
b
>>>
[[ 1 2 9 10]
[ 5 6 7 8]]
c = np.vatack(a, b)
c
>>>
[[ 1 2 3 4]
[ 5 6 7 8]
[ 1 2 9 10]
[ 5 6 7 8]]
二、vatack()
#vertical stack (类似于水平合并)
import numpy as np
a = np.array([[1, 2, 3, 4], [5, 6, 7, 8]])
b = np.array([[1, 2, 9, 10], [5, 6, 7, 8]])
a
>>>
[[1 2 3 4]
[5 6 7 8]]
b
>>>
[[ 1 2 9 10]
[ 5 6 7 8]]
c = np.hatack(a, b)
c
>>>
[[ 1 2 3 4 1 2 9 10]
[ 5 6 7 8 5 6 7 8]]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)