How to add an extra column to a NumPy array
Let’s say I have a NumPy array, a
:
a = np.array([
[1, 2, 3],
[2, 3, 4]
])
And I would like to add a column of zeros to get an array, b
:
b = np.array([
[1, 2, 3, 0],
[2, 3, 4, 0]
])
How can I do this easily in NumPy?