Answers for "numpy concatenate two vectors"

13

numpy merge arrays

>>> a = np.array([[1, 2], [3, 4]])
>>> b = np.array([[5, 6]])
>>> np.concatenate((a, b), axis=0)
array([[1, 2],
       [3, 4],
       [5, 6]])
>>> np.concatenate((a, b.T), axis=1)
array([[1, 2, 5],
       [3, 4, 6]])
Posted by: Guest on August-07-2020
3

join two numpy 2d array

import numpy as np

a = np.array([[0, 1, 3], [5, 7, 9]])
b = np.array([[0, 2, 4], [6, 8, 10]])
c = np.concatenate((a, b), axis=0)
print(c)

Output : 
[[ 0  1  3]
 [ 5  7  9]
 [ 0  2  4]
 [ 6  8 10]]
Posted by: Guest on September-23-2020
0

np.concatenate

numpy.concatenate((a1, a2, ...), axis)
Posted by: Guest on May-09-2020

Code answers related to "numpy concatenate two vectors"

Python Answers by Framework

Browse Popular Code Answers by Language