numpy.concatenate((a1, a2, ...), axis=0, out=None, dtype=None, casting="same_kind")
import numpy as np
x=np.ones((1,2))
print(x)
[[1. 1.]]
y=np.zeros((1,2))
print(y)
[[0. 0.]]
ans1=np.concatenate((x,y),axis=1)
print(ans1)
[[1. 1. 0. 0.]]
ans2=np.concatenate((x,y),axis=0)
print(ans2)
[[1. 1.]
[0. 0.]]
x=np.ones((2,2))
print(x)
[[1. 1.]
[1. 1.]]
y=np.zeros((1,2))
print(y)
[[0. 0.]]
ans1=np.concatenate((x,y.T),axis=1)
print(ans1)
[[1. 1. 0.]
[1. 1. 0.]]
ans2=np.concatenate((x,y),axis=0)
print(ans2)
[[1. 1.]
[1. 1.]
[0. 0.]]
ans3=np.concatenate((x,y),axis=None)
print(ans3)
[1. 1. 1. 1. 0. 0.]
|