Interpolating a numpy array to fit another array
问题 Say I have some_data of shape (1, n) . I have new incoming_data of shape (1, n±x) , where x is some positive integer much smaller than n . I would like to squeeze or stretch incoming_data such that it is of the same length as n . How might this be done, using the SciPy stack? Here's an example of what I'm trying to accomplish. # Stretch arr2 to arr1's shape while "filling in" interpolated value arr1 = np.array([1, 5, 2, 3, 7, 2, 1]) arr2 = np.array([1, 5, 2, 3, 7, 1]) result > np.array([1, 5,