Resample a numpy array
问题 It's easy to resample an array like a = numpy.array([1,2,3,4,5,6,7,8,9,10]) with an integer resampling factor . For instance, with a factor 2 : b = a[::2] # [1 3 5 7 9] But with a non-integer resampling factor, it doesn't work so easily : c = a[::1.5] # [1 2 3 4 5 6 7 8 9 10] => not what is needed... It should be (with linear interpolation): [1 2.5 4 5.5 7 8.5 10] or (by taking the nearest neighbour in the array) [1 3 4 6 7 9 10] How to resample a numpy array with a non-integer resampling