![]() |
How to add a number to each column separtely in numpy array? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to add a number to each column separtely in numpy array? (/thread-28040.html) |
How to add a number to each column separtely in numpy array? - Oliver - Jul-02-2020 I have a numpy array created like below for a graph. It graphs a unit box. np.array([[x, y] for x in np.arange(0, 1.01, .01) for y in np.arange(0, 1.01, .01)])I want to transform this "box" with a new numpy array so the new box appears elsewhere on the graph. Having some trouble figuring out if I can slice a numpy array to do the addition I need. My question is how do I add, say 1 to each x element and 3 to each y element? Thanks in advance, - oliver |