Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Converting set of tuples to set of 2D numpy arrays
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))

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  converting dataframe to int numpy array glennford49 1 246 Apr-04-2020, 06:15 AM
Last Post: snippsat
  Corrupted numpy arrays when save to file. DreamingInsanity 2 459 Dec-14-2019, 12:12 PM
Last Post: DreamingInsanity
  Numpy arrays and compatability with Fortran arrays merrittr 0 357 Sep-03-2019, 03:54 AM
Last Post: merrittr
  numpy.copy / numpy.delete paul18fr 3 644 Jul-26-2019, 01:51 PM
Last Post: paul18fr
  "erlarge" a numpy-matrix to numpy-array PhysChem 2 696 Apr-09-2019, 04:54 PM
Last Post: PhysChem
  numpy subtraction of two arrays devenuro 1 7,344 Sep-24-2018, 12:55 AM
Last Post: Mekire

Forum Jump:

Users browsing this thread: 1 Guest(s)