I'm trying to categorize numbers into "bins" so if a bin is all numbers in the range 0 to 20, then 19 falls into that bin.
I'm trying to do this without using a bunch of if-then states like so:
if x < 0.5:
return "bin1"
elif x < 0.8:
return "bin2"
...
Numpy has a numpy.linspace method that generates a numpy array with evenly spaced bins. However, I still don't see how to do this bin categorization efficiently without taking the results of the array and putting them in "if" statements. Thanks.