Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Julia 为什么我会收到;TypeError:在布尔上下文中使用非布尔(DataArrays.NAtype)“;?_Julia - Fatal编程技术网

Julia 为什么我会收到;TypeError:在布尔上下文中使用非布尔(DataArrays.NAtype)“;?

Julia 为什么我会收到;TypeError:在布尔上下文中使用非布尔(DataArrays.NAtype)“;?,julia,Julia,我想知道是否有人能向我解释这个错误的含义,以及可能如何解决它。如果需要的话,我可以包括整个程序的代码,但这里是我收到的错误消息,以及导致它的程序部分 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

我想知道是否有人能向我解释这个错误的含义,以及可能如何解决它。如果需要的话,我可以包括整个程序的代码,但这里是我收到的错误消息,以及导致它的程序部分

    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
这里是错误

    TypeError: non-boolean (DataArrays.NAtype) used in boolean context
 in create_lineups at C:\Users\Jake\Documents\GitHub\MLB_DFS_ALGO.jl:176
 in include_string at loading.jl:288
 in eval at C:\Users\Jake\.julia\v0.4\Atom\src\Atom.jl:3
 [inlined code] from C:\Users\Jake\.julia\v0.4\Atom\src\eval.jl:39
 in anonymous at C:\Users\Jake\.julia\v0.4\Atom\src\eval.jl:108
 in withpath at C:\Users\Jake\.julia\v0.4\Requires\src\require.jl:37
 in withpath at C:\Users\Jake\.julia\v0.4\Atom\src\eval.jl:53
 [inlined code] from C:\Users\Jake\.julia\v0.4\Atom\src\eval.jl:107
 in anonymous at task.jl:58

如果有人能解释为什么会发生这种情况,或者指出我的一个愚蠢错误,我将不胜感激。

这意味着您的数据帧至少包含一个NA。在尝试将数据与
==

进行比较之前,您需要确保数据不包含缺失的值或显式处理它们。这意味着您的数据帧至少包含一个NA。在尝试将数据与
=

进行比较之前,您需要确保数据不包含缺失的值或显式处理它们。感谢您的帮助,我不确定是否需要删除数据框中的空行,但现在我知道我需要。感谢您的帮助,我不确定是否需要删除数据帧中的空行,但现在我知道我需要。