我正在尝试编写一段非常简单的代码,该代码将从一组现有数据进行插值以创建值的合成分布。到目前为止,我的代码如下所示:import pandas as pdimport numpy as npimport scipyfrom scipy.interpolate import griddataimport matplotlibCRN_data=pd.read_table('disequilibrium data.dat',sep=',')kzz=CRN_data['Kzz']temperature=CRN_data['Temperature']degree=CRN_data['Mean Degree']points=np.ndarray(shape=(len(kzz),2),dtype='float')for i in range(len(kzz)): points[i][0]=kzz[i] points[i][1]=temperature[i]gridx,gridy= np.mgrid[0:1:100j,0:1:200j]grid=griddata(points,degree,(gridx,gridy),method='cubic')print grid我插入的数据集如下所示:Kzz,Temperature,Mean Degree, 1.00E+06,400,7.41E+181.00E+06,500,4.48E+23...1.00E+08,400,4.67E+181.00E+08,500,6.88E+231.00E+08,750,1.88E+34...1.00E+10,750,2.73E+331.00E+10,900,2.82E+371.00E+10,1000,1.19E+39...然而,当代码运行时,我得到的主要输出是[[ nan nan nan ..., nan nan nan] [ nan nan nan ..., nan nan nan] [ nan nan nan ..., nan nan nan] ..., [ nan nan nan ..., nan nan nan] [ nan nan nan ..., nan nan nan] [ nan nan nan ..., nan nan nan]]这显然不是很有帮助。这是 Scipy 中的错误,还是(更有可能)我做错了什么?
添加回答
举报
0/150
提交
取消