I have a list containing more than 100,000 values in it.
I need to divide the list into multiple smaller lists based on a specific bin width say 0.1. Can anyone hel
This will create a dict where each value is a list of elements that fit in a bin.
import collections bins = collections.defaultdict(list) binId = lambda x: int(x*10) for val in vals: bins[binId(val)].append(val)