2016-06-30 4 views
0

누구든지 내게이 오류의 의미와 가능한 해결 방법을 설명 할 수 있는지 궁금합니다. 필요한 경우 전체 프로그램 코드를 포함 할 수 있지만 여기에는 내가받는 오류 메시지와 프로그램을 일으키는 부분이 있습니다.부울 컨텍스트에 "TypeError : non-boolean (DataArrays.NAtype)"이 표시되는 이유는 무엇입니까?

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 

사람이 내가 그것을 대단히 감사하겠습니다 내 바보 같은 오류 중 하나가 일어나고, 또는 지점 이유를 설명 할 수있는 경우이다.

답변

3

이것은 데이터 프레임에 NA가 하나 이상 있음을 의미합니다. ==과 비교하기 전에 데이터에 누락 값이 없거나 명시 적으로 처리해야합니다.

+0

도움을 주셔서 감사합니다. DataFrame에서 빈 행을 삭제해야하는지 여부는 확실하지 않지만 현재 알 수 있습니다. –

관련 문제