There is this How do you split a list into evenly sized chunks?
for splitting an array into chunks. Is there anyway to do this more efficiently for giant arrays using Numpy?
There is this How do you split a list into evenly sized chunks? for
Share
Try
numpy.array_split.From the documentation:
Identical to
numpy.split, but won’t raise an exception if the groups aren’t equal length.If number of chunks > len(array) you get blank arrays nested inside, to address that – if your split array is saved in
a, then you can remove empty arrays by:Just save that back in
aif you wish.