采用numpy实现数组拼接
水平拼接
import numpy
as np
a
= [1,2,3]
b
=[4,5,6]
result
= np
.hstack
((a
,b
))
print('result:\n',result
)
输出结果:
result
:
[1 2 3 4 5 6]
垂直拼接
import numpy
as np
a
= [1,2,3]
b
=[4,5,6]
result
= np
.vstack
((a
,b
))
print('result:\n',result
)
输出结果:
result
:
[[1 2 3]
[4 5 6]]
转载请注明原文地址:https://blackberry.8miu.com/read-41732.html