我尝试使用函数InterpolatedUnivariateSpline作为:
from scipy.interpolate import InterpolatedUnivariateSpline
A = np.array([1,2,3,4,5])
B = np.array([11,34,56,78,19])
C = np.random.normal(0, 1, (500, 30))
model = InterpolatedUnivariateSpline(A, B, k = 1)
C2 = model(C) #fails with error object too deep for desired array
C2 = model(C[:,0]) #works but is not useful as I need inter-/extra-polation for entire C
那么,如何将函数应用于数组C的所有元素呢
编辑:scipy版本:0.13.2
如果我理解正确,你可以使用列表理解:
它将在所有元素上运行“model”并返回列表
将
scipy
升级到版本0.16.1,它将适用于多维数组,即:工作。你知道吗
相关问题 更多 >
编程相关推荐