我用skillmetrics包编写了一个简单的代码来形成taylor图。我使用了python版本python2.7.12以下内容:-在
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import skill_metrics as sm
fire=pd.read_csv('fire.csv')
PMfire = zip(fire['Date'],fire['PM_fire'],fire['Embassy_PM'])
#taylor_stats1 = sm.taylor_statistics('PM_fire','Embassy_PM','Date')
o= {"Data":fire['Embassy_PM'],'Date':fire['Date']}# form date and and embassy datas
p= {"Data":fire['PM_fire'],'Date':fire['Date']}# form dictionary containg pm_fire and date
# Calculate statistics for Taylor diagram
# The first array element corresponds to the reference series
# for the while the second is that for the predicted series.
taylor_stats1 = sm.taylor_statistics(p,o,'Data')
sdev = np.array([taylor_stats1['sdev'][0]])# Calculate standard deviation
crmsd = np.array([taylor_stats1['crmsd'][0]])#Calculate root mean square difference
ccoef = np.array([taylor_stats1['ccoef'][0]])# Calculate correlation coefficient
sm.taylor_diagram(sdev,crmsd,ccoef)#form taylor digram
plt.savefig('taylor.png')
plt.show()
一开始我在链接AttributeError: 'module' object has no attribute 'to_rgb'中得到了错误。但是,现在我得到了以下错误:
^{pr2}$我也试过shape mismatch: value array of shape (2,) could not be broadcast to indexing result of shape (1,)。然后尝试了python3.5.2。但是,它给了我同样的错误。在
目前没有回答
相关问题 更多 >
编程相关推荐