# JuliaDB ignoring variables of the wrong type

**URL:** <https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739>\
**Category:** New to Julia\
**Created:** [May 24, 2021, 6:53pm UTC](https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739 "2021-05-24T18:53:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joao](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joao](https://discourse.julialang.org/u/Joao)\
**Post date:** [May 24, 2021, 6:53pm UTC](https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739/1 "2021-05-24T18:53:30Z")

</div>

Hello all. First days in Julia, so please be patient. 🙂

I am reading a table with JuliaDB and one of the variables is an integer. I have declared that with colparsers. Julia gives an error if the variable is not an integer in any of the observations, but instead I would like it to register as empty file, e.g. if the variable equals ‘b’ for some observation, read it as empty.

Thank you.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 25, 2021, 2:23pm UTC](https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739/2 "2021-05-25T14:23:23Z")

</div>

I am not familiar with JuliaDB so maybe there is a better way to do this, but

```julia
try
    # read the file with JuliaDB
catch e
    if e == the_kind_of_exception_JuliaDB_gives
        # return an empty file, whatever that is
    else
        rethrow(e)
    end
end

```

or something along those lines. See

[https://docs.julialang.org/en/v1/manual/control-flow/#The-try/catch-statement](https://docs.julialang.org/en/v1/manual/control-flow/#The-try/catch-statement)

---

<div class="post-metadata">

**Author:** ![Joao](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joao](https://discourse.julialang.org/u/Joao)\
**Post date:** [May 25, 2021, 5:57pm UTC](https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739/3 "2021-05-25T17:57:15Z")

</div>

Thank you. Your solution would give me the error, which I kind of know already. I was looking for a possible solution. This should not be difficult. All I want is for JuliaDB to read as integer, or float, of whatever type I desire, and if that is not possible, e.g. a string appears, return the value as empty.

---

<div class="post-metadata">

**Author:** ![Joao](https://avatars.discourse-cdn.com/v4/letter/j/7feea3/32.png) [@Joao](https://discourse.julialang.org/u/Joao)\
**Post date:** [May 25, 2021, 5:58pm UTC](https://discourse.julialang.org/t/juliadb-ignoring-variables-of-the-wrong-type/61739/4 "2021-05-25T17:58:36Z")

</div>

This works:  
@time beta = loadtable(“data/data\_disaggregated”, colparsers=Dict(:DATE =\> dateformat"d/m/y",:n =\> Int64))

But that does not:  
@time beta = loadtable(“data/data\_disaggregated”, colparsers=Dict(:DATE =\> dateformat"d/m/y",:n =\> Int64. :RET =\> Float64))

The error:  
Could not convert column RET of eltype Union{Missing,Float64} to eltype Float64
