Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Adding data in 3D array from 2D numpy array
I have one array of size Arr1= 2096 x 49, another array Arr2 of size 121 x 1232 x 49. and list of u_nodes[] have size 2096 and v_nodes of size 2096 containing the row and column indexes. I want to get row and column from these lists and values from Arr1 and insert in 3D array.
Arr2 = np.full((121, 1232, 49), -1, dtype=np.int32) //initializing
Arr2[u_nodes, v_nodes] = np.array([ Arr2[i] for i in range(2096)]) 
but its not working. Following error
ValueError: shape mismatch: value array of shape (2096,1,49) could not be broadcast to indexing result of shape (2296,49)
scidam wrote Jul-24-2020, 02:09 AM:
Please post all code, output and errors (in it's entirety) between their respective tags. I did it for you this time, Here are instructions on how to do it yourself next time.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Array issues Bmart6969 1 143 Jul-18-2020, 11:03 AM
Last Post: ndc85430
  cannot reshape array of size 0 into shape Roro 2 527 Jun-14-2020, 11:28 AM
Last Post: Roro
  Python changed array shape without telling me BrendanGolledge 3 223 Jun-11-2020, 07:41 AM
Last Post: Yoriz
  array coding problem pberrett 3 299 May-08-2020, 05:54 AM
Last Post: nnk
  ValueError: Found array with 0 samples marcellam 1 423 Apr-22-2020, 04:12 PM
Last Post: jefsummers
  np.array question hissonrr 3 337 Apr-20-2020, 01:15 PM
Last Post: hissonrr
  Create multiple quiver plots 3D array PengEng 0 235 Apr-14-2020, 12:57 PM
Last Post: PengEng
  Read json array data by pandas vipinct 0 250 Apr-13-2020, 02:24 PM
Last Post: vipinct
  define certain array elements+display with digits lukezo 0 241 Apr-10-2020, 05:03 PM
Last Post: lukezo
  Creating look up table/matrix from 3d data array chai0404 3 366 Apr-09-2020, 04:53 AM
Last Post: buran

Forum Jump:

Users browsing this thread: 1 Guest(s)