Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Converting set of tuples to set of 2D numpy arrays
#1
I have coded a function that returns a set of tuples, each tuple being of size 6, and assigned it to a var named tmp. Now I need to convert each tuple to a numpy array so I can reshape it into a 2x3 array.

With the code I've made however, I end up with a an array, that contains all of the 1D arrays from all the reshapes. But what I want is a collection (a list presumably) that contains each of the reshaped arrays separately so that I get each 2D array when I iterate through the collection.

This is the line of code I've made, but it doesn't wield the result I'm trying to get. And I just can't figure out how to do this.

Quote: coll = np.reshape((np.array(list(v for v in tmp))), (-1,3))
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Numpy arrays and compatability with Fortran arrays merrittr 0 144 Sep-03-2019, 03:54 AM
Last Post: merrittr
  numpy.copy / numpy.delete paul18fr 3 229 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 360 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  numpy subtraction of two arrays devenuro 1 4,023 Sep-24-2018, 12:55 AM
Last Post: Mekire

Forum Jump:


Users browsing this thread: 1 Guest(s)