My code was working fine until I updated Numpy to 1.13.1. Now I get the following error
IndexError: boolean index did not match indexed array along dimension 0; dimension is 5 but corresponding boolean dimension is 4
… which is thrown at this line:
m = arr[np.diff(np.cumsum(arr) >= sum(arr) * i)]
I can’t seem to wrap my head around it. Any suggestions?
Here is my sample code:
a = [1,2,3,4,5] l = [0.85,0.90] s = sorted(a, reverse = False) arr = np.array(s) for i in l: m = arr[np.diff(np.cumsum(arr) >= sum(arr) * i)]