Numpy-concatenate
提供:Dev Guides
numpy.concatenate
連結とは、結合を指します。 この関数は、指定された軸に沿って同じ形状の2つ以上の配列を結合するために使用されます。 この関数は、次のパラメーターを取ります。
numpy.concatenate((a1, a2, ...), axis)
どこで、
Sr.No. | Parameter & Description |
---|---|
1 |
a1,a2.. 同じタイプの配列のシーケンス |
2 |
axis 配列を結合する必要がある軸。 デフォルトは0 |
例
import numpy as np
a = np.array([[print 'First array:'
print a
print '\n'
b = np.array([[print 'Second array:'
print b
print '\n'
# both the arrays are of same dimensions
print 'Joining the two arrays along axis 0:'
print np.concatenate((a,b))
print '\n'
print 'Joining the two arrays along axis 1:'
print np.concatenate((a,b),axis = 1)
その出力は次のとおりです-
First array:
[[Second array:
[[Joining the two arrays along axis 0:
[[Joining the two arrays along axis 1:
[[