In my code, I have created 10 bins (specific ranges of bins are listed below):
4100000-4155304
4155304-4210608
4210608-4321216
4321216-4542432
4542432-4984865
4984865-5327533
5327533-5670201
5670201-5746217
5746217-5873109
5873109-6000000
bins = [4100000,4155304,4210608,4321216,4542432,4984865,5327533,5670201,5746217,5873109,6000000] bin_indices = np.digitize(bins_array, bins)
Is there a way I can do this without having to list all the bin numbers (bins = [bin numbers]), and maybe also without having to use np.digitize? Thank you very much!
Simply use the
numpy.arange
method:Output
Cheers