Sep-25-2019, 08:47 AM
Hi!
I'm dealing with huge data and I'm looking for an efficient way to reshape my list of arrays. Here is my solution which I find to be slow
the output I require:
I'm using the following code:
Is there a more efficient way?
Thank you for your help.
I'm dealing with huge data and I'm looking for an efficient way to reshape my list of arrays. Here is my solution which I find to be slow
1 2 3 4 |
#x is an input of shape [file,measurement, array(n,r)], i.e. #len(x) returns file #len(x[0]) returns measurement #x[0][0].shape returns (n,r) |
1 |
#new_x is a list of arrays, its shape is [file*measurement*n, array(r)] |
1 2 3 4 5 |
new_x = [] for ii in range ( len (x)): for jj in range ( len (x[ 0 ])): for kk in range ( len (x[ 0 ][ 0 ])): new_x.append(x[ii][jj][kk]) |
Thank you for your help.