I have an array as:
A = [1,8,2,6,4,8,1,0,1,6,7,3,1,4,9,1,2,1,2,1,1,2]
and I'd like to rebin/group it into a smaller size array, which has at least a value of 10 in each entry, i.e.:
A_reb = [[1,8,2],[6,4],[8,1,0,1],[6,7],[3,1,4,9],[1,2,1,2,1,1,2]]
A_reb = [11, 10, 10, 13, 17, 10]
Is there an effective way to do it in python? Thanks in advance.
Try this :