It’s hard to describe this problem, but the code below should clarify.
Basically i start with an array where first element is another array of N size.
the rest of the array is a single element. I want to split the first element a for every partion, fill with the remainder of the array:
import pandas as pd, numpy as np
data = [['100', '200', '300', '400'],
'val1',
'val2',
]
ids = np.array_split(data[0], 2)
new_array = []
for id in ids:
data[0] = id
new_array.append(data[:])
new_array
So i end up with this:
[[['100', '200'], 'val1', 'val2'],
[['300', '400'], 'val1', 'val2']]
is this the best way of doing this that will also be fast for very large arrays?