I’d like to sort into new lists those items in this list…
truc = [['12', 'brett', 5548],
['22.3', 'troy', 9514],
['8.1', 'hings', 12635],
['34.2', 'dab', 17666],
['4q3', 'sigma', 18065],
['4q3', 'delta', 18068]]
… grouping them using the last field, into bins of size 3500
So, the ideal result would be this:
firstSort = [['34.2', 'dab', 17666],
['4q3', 'sigma', 18065],
['4q3', 'delta', 18068]]
secondSort = [['22.3', 'troy', 9514],
['8.1', 'hings', 12635]]
lastSort = ['12', 'brett', 5548]
I tried to use the itertools.groupby() function, but i am not capable of find a way to specify the bin size.
This is trivial to do without itertools
Output: