Python Forum
Turn list of arrays into an array of lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Turn list of arrays into an array of lists
#1
Hey everyone,

I am currently struggling with the structure of data I receive. As a result of another (not important here) function I get a list filled with numpy arrays at a large scale (about 20 thousand entries):


first_array=[array([[1, 0, 2, 4, 3]], dtype=int64),
 array([[2, 6, 8, 3, 3]], dtype=int64),
 array([[0, 0, 4, 3, 3]], dtype=int64),
 array([[4, 4, 3, 2, 3]], dtype=int64),
...]
For the further procession of this data I need this input in the reverse structure: An array of lists like the following form:

output_array=array([
       [1, 0, 2, 4, 3],
       [2, 6, 8, 3, 3],
       [0, 0, 4, 3, 3],
       [4, 4, 3, 2, 3],
....])
Is there a way of doing this in a way that keeps the computational time low? Huh
Reply


Messages In This Thread
Turn list of arrays into an array of lists - by Cola_Reb - Jul-19-2022, 04:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  comparing floating point arrays to arrays of integers in Numpy amjass12 0 1,695 Jul-26-2021, 11:58 AM
Last Post: amjass12
  Array lists vs Linked Lists sabe 2 1,829 Nov-28-2020, 12:31 AM
Last Post: perfringo
  Numpy arrays and compatability with Fortran arrays merrittr 0 1,942 Sep-03-2019, 03:54 AM
Last Post: merrittr
  Convert element of list to integer(Two dimentional array) zorro_phu 3 4,917 Jun-12-2018, 04:49 AM
Last Post: zorro_phu
  Importing matlab cell array (.mat) into a python list scanato 0 8,733 Nov-15-2017, 11:04 AM
Last Post: scanato
  Calculate the mean of an array across dimension with lists of different length rakhmadiev 2 4,606 Aug-01-2017, 02:52 AM
Last Post: Larz60+
  Are lists Python's name for "variable array" Luke_Drillbrain 6 5,068 Apr-21-2017, 09:14 AM
Last Post: volcano63

Forum Jump:

User Panel Messages

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