When processing signals, you can think of resampling as the main scaling of the array and interpolation of the missing values ββor values ββwith a non-integer index using the methods of nearest, linear, cubic, etc.
Using scipy.interpolate.interp1d , you can achieve one-dimensional oversampling using the following function
def resample(x, factor, kind='linear'): n = np.ceil(x.size / factor) f = interp1d(np.linspace(0, 1, x.size), x, kind) return f(np.linspace(0, 1, n))
eg:
a = np.array([1,2,3,4,5,6,7,8,9,10]) resample(a, factor=1.5, kind='linear')
profitability
array([ 1. , 2.5, 4. , 5.5, 7. , 8.5, 10. ])
and
a = np.array([1,2,3,4,5,6,7,8,9,10]) resample(a, factor=1.5, kind='nearest')
profitability
array([ 1., 2., 4., 5., 7., 8., 10.])