Let's say I have a nested array like so:
array = [[1,7], [49, 9], [3, 80], [13, 15]]
From the above array, I want to create two new arrays (within a nested array) based on vertical "columns". This is my desired output:
new_array = [[1, 49, 3, 13], [7, 9, 80, 15]]
I want the logic to work weather I have individually nested arrays of length 2 (as in my example) or 30 (or more).
I tried using a dictionary to do this. The logic of the code looked something like this but the dictionary is not producing what I'm looking for:
featureCol["valuesList{}".format(i)].append(nestedArray[i])
Also, the only library I can use is numpy
. I don't have any additional libraries available to me in Python.