axis=0表述列
axis=1表述行
如下面例子:
In [52]: arr=np.arange(12).reshape((3,4))
In [53]:arr
Out[53]:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
In [54]:np.concatenate([arr,arr],axis=0)
Out[54]:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
In [55]:np.concatenate([arr,arr],axis=1)
Out[55]:
array([[ 0, 1, 2, 3, 0, 1, 2, 3],
[ 4, 5, 6, 7, 4, 5, 6, 7],
[ 8, 9, 10, 11, 8, 9, 10, 11]])
---------------------
作者:Rango_lhl
来源:CSDN
原文:https://blog.csdn.net/rango_lhl/article/details/50542887
版权声明:本文为博主原创文章,转载请附上博文链接!