Chase CB
Chase CB

Reputation: 1627

Julia writing to binary error

I'm trying to write to binary data using from a partitioned data frame. Generally, this process works fine however occasionally I get some errors. I have a written a basic conditional to address the error (I have also used try/catch blocks but I'm working with a relatively large data set and so I think the Boolean might be faster if that assumption is false feel free to make fun of me and/or my friends). Here is some code:

for x in RICT["$i"]["Numbers"]

    if typeof(x) == "NAtype"

        write(f3, convert(ASCIIString, "$x" ))

    else

        write(f3, convert(Int32, x ) )

    end

end

here is the error which my diminutive understanding of life and Julia tells me I shouldn't be seeing:

no method convert(Type{Int32},NAtype)

Thanks so much.

Upvotes: 1

Views: 84

Answers (1)

Mr Alpha
Mr Alpha

Reputation: 1843

The output of typeof(x) is not a string so it will never match "NAtype". Remove the quotation marks from around NAtype and then it should work.

Upvotes: 2

Related Questions