Let’s say I have a NumPy array, a:
a
a = np.array([ [1, 2, 3], [2, 3, 4] ])
And I would like to add a column of ze
A bit late to the party, but nobody posted this answer yet, so for the sake of completeness: you can do this with list comprehensions, on a plain Python array:
source = a.tolist() result = [row + [0] for row in source] b = np.array(result)