【发布时间】:2019-03-27 02:34:42
【问题描述】:
'''我正在开展一个分析和预测有关板球数据集的信息的项目。我遇到了 numpy.ndarrary 对象不可调用的错误。我应该如何解决这个错误'''
team1='MI'
team2='CSK'
toss_winner='CSK'
input=[dicVal[team1],dicVal[team2],'15',dicVal[toss_winner],'12','1']
input = np.array(input).reshape((1, -1))
output=model.predict(input)
print(list(dicVal.keys())[list(dicVal.values()).index(output)])
#This code works fine as there is direct initialization of team1 and team2
team1=input("Enter team-1 :") #<--numpy.ndarrary object not callable
team2=input("Enter team-2 :")
toss_winner=input("Enter toss winner :")
city=input("Enter the corresponding no for the following cities :")
venue=input("Enter the corresponding no for the following stadiums :")
toss=input("Enter the corresponding no for the following toss decision :")
input=[dicVal[team1],dicVal[team2],venue,dicVal[toss_winner],city,toss]
input = np.array(input).reshape((1, -1))
output=model.predict(input)
print(list(dicVal.keys())[list(dicVal.values()).index(output)])
'''在第一行本身我得到一个 numpy.ndarrary object not callable 的错误。请帮我解决这个问题。'''
【问题讨论】: