So I have a array of arrays, like
[array([-0.05504106, 4.21890792]), array([-0.05504106, 4.21890792]), array([-0.0533802 , 4.10717668]), array([-0.0546635 , 4.19501313])]
And what I'm attempting to do is make it into an array of 2 arrays, in which the components are put together like this:
[array([-0.05504106, -0.05504106, -.0533802, -.0546635]), array([4.21890792, 4.21890792, 4.10717668, 4.19501313])
I've tried a number of approaches. The first is as follows:
for i in range(len(array_1)-1):
zipped = zip(array_1[i], array_1[i+1], array_1[i+2])
print zipped
However, this approach has the drawback of having to add an array_1[i+n] for each additional array within array_1. Not at all practical if array_1 has many arrays within it.
The next thing I tried was attempting to use itertools.repeat in conjunction with the above code, like so:
for i in range(len(array_1)-1):
zipped = zip(itertools.repeat(array_1[i], len(array_1))
print zipped
however, this did not function the way I wanted it to.
Could you give me some idea of how I would accomplish this task? Should I be using zip and/or intertools.repeat?
[(array[0][0], array[1][0], ..., array[n][0]), (array[0][1], ..., array[n][1]), ..., (array[0][m], ..., array[n][m])]?