Concatenate Several Np Arrays In Python
Answer :
concatenate
can accept a sequence of array-likes, such as args
:
In [11]: args = (x1, x2, x3)
In [12]: xt = np.concatenate(args)
In [13]: xt
Out[13]: array([1, 0, 1, 0, 0, 1, 1, 1, 1])
By the way, although axis=1
works, the inputs are all 1-dimensional arrays (so they only have a 0-axis). So it makes more sense to use axis=0
or omit axis
entirely since the default is axis=0
.
Comments
Post a Comment