Python Forum
How to add a number to each column separtely in numpy array?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add a number to each column separtely in numpy array?
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert numpy array to image without loading it into RAM. DreamingInsanity 7 5,895 Feb-08-2024, 09:38 AM
Last Post: paul18fr
  IPython errors for numpy array min/max methods muelaner 1 562 Nov-04-2023, 09:22 PM
Last Post: snippsat
  Expand the range of a NumPy array? PythonNPC 0 752 Jan-31-2023, 02:41 AM
Last Post: PythonNPC
  Change a numpy array to a dataframe Led_Zeppelin 3 1,114 Jan-26-2023, 09:01 PM
Last Post: deanhystad
  from numpy array to csv - rounding SchroedingersLion 6 2,173 Nov-14-2022, 09:09 PM
Last Post: deanhystad
  numpy.array has no attribute head Led_Zeppelin 1 1,238 Jul-13-2022, 12:56 AM
Last Post: Led_Zeppelin
  Seeing al the data in a dataframe or numpy.array Led_Zeppelin 1 1,143 Jul-11-2022, 08:54 PM
Last Post: Larz60+
  go over and search in numpy array faster caro 7 1,754 Jun-20-2022, 04:54 PM
Last Post: deanhystad
  Creating a numpy array from specific values of a spreadsheet column JulianZ 0 1,123 Apr-19-2022, 07:36 AM
Last Post: JulianZ
  Trying to understand Numpy/array nabuchadresar 2 1,828 Dec-17-2021, 07:52 AM
Last Post: nabuchadresar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020