我想知道是否有人可以向我解释这个错误意味着什么,以及可能如何解决它。如果需要,我可以包含整个代码程序,但这里是我收到的错误消息,以及导致它的程序部分。
Meeting
这是错误
for i =1:num_hitters
if hitters[i,:Position] == "OF"
outfield=vcat(outfield,fill(1,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(0,1))
shortstop=vcat(shortstop,fill(0,1))
elseif hitters[i,:Position] == "C"
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(1,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(0,1))
shortstop=vcat(shortstop,fill(0,1))
elseif hitters[i,:Position] == "1B"
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(1,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(0,1))
shortstop=vcat(shortstop,fill(0,1))
elseif hitters[i,:Position] == "2B"
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(1,1))
thirdbase=vcat(thirdbase,fill(0,1))
shortstop=vcat(shortstop,fill(0,1))
elseif hitters[i,:Position] == "3B"
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(1,1))
shortstop=vcat(shortstop,fill(0,1))
elseif hitters[i,:Position] == "SS"
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
shortstop=vcat(shortstop,fill(1,1))
else
outfield=vcat(outfield,fill(0,1))
catchers=vcat(catchers,fill(0,1))
firstbase=vcat(firstbase,fill(0,1))
secondbase=vcat(secondbase,fill(0,1))
thirdbase=vcat(thirdbase,fill(0,1))
shortstop=vcat(shortstop,fill(1,1))
end
end
如果有人能够解释为什么会发生这种情况,或者指出我的一个愚蠢的错误,我会非常感激。
答案 0 :(得分:2)
这意味着您的DataFrame至少包含一个NA。在尝试将数据与==
进行比较之前,您需要确保数据不包含缺失值或明确处理它们。