I got the following array:
a = []
for i in range(5):
a.append(np.array(range(5)))
a = np.array(a)
array([[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4],
[0, 1, 2, 3, 4]])
I want to add an extra 'column' to the data, such that it looks like this:
array([[0, 1, 2, 3, 4, 5],
[0, 1, 2, 3, 4, 5],
[0, 1, 2, 3, 4, 5],
[0, 1, 2, 3, 4, 5],
[0, 1, 2, 3, 4, 5]])
However, the only way I can think of is like the following. Is there not a better way?
a = np.array([np.insert(i,5,5) for i in a])