Whats the most efficient way to update a specific column in numpy? For simplicity, say i have:
[[0 2]
[1 2]
[2 2]]
Then I would like to add 2 on every element on the second column.
[[0 4]
[1 4]
[2 4]]
This can be simply done with a loop, but I was wondering if theres a numpy function I could use that would be more efficient. Assuming the array is quite large.
a[:, 1] += 2You may want to read about Numpy indexingnumpy, so just usearr[:,1] += 2.