Solved by ptrblck in post #3 
              
              
                You could use np.digitize to create the indices of the bins and then use the one_hot method as seen here: 
x = np.array([ 0.0379, -0.0372,  0.0277, -0.1918, -0.0679,  0.0858,  0.0655,  0.2807,
              -0.1375, -0.0066,  0.1309,  0.0893,  0.0757,  0.1891,  0.2998, -0.1810,
              -0.0809…