# Beginner: LoadError: InexactError: trunc..when convert dataframe

**URL:** https://discourse.julialang.org/t/beginner-loaderror-inexacterror-trunc-when-convert-dataframe/18151
**Category:** General Usage
**Created:** [November 29, 2018, 4:28pm UTC](https://discourse.julialang.org/t/beginner-loaderror-inexacterror-trunc-when-convert-dataframe/18151 "2018-11-29T16:28:36Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![xaver](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xaver](https://discourse.julialang.org/u/xaver)
#### Post date: [November 29, 2018, 4:28pm UTC](https://discourse.julialang.org/t/beginner-loaderror-inexacterror-trunc-when-convert-dataframe/18151/1 "2018-11-29T16:28:37Z")

</div>

I use

using DataFrames, CSV  
…  
**huhu=convert(DataFrame,dbtip)**

when the DataFrame has about 10000 rows I am getting the message

**LoadError: InexactError: trunc(Int8, 128)**  
**in expression starting at /home/jiricvrk/Julia/tipy.jl:20**  
**…**

but the file created with the next instruction  
CSV.write(“dbtip.csv”, huhu, delim = ‘;’)  
is completed. When I use smaller dataframe there is no problem.

The problematic instruction is on line 65, but the listing means line 20 at first.  
**Please how do you recommend to modify my convert instruction?**

I am using Julia 1.0.2 (previous 1.0.1) with Atom on Ubuntu 18.10.

Thank you very much for any help. And please excuse my English ;).

**Regards, Jiri Cvrk**

The full listing of an error follows:  
LoadError: InexactError: trunc(Int8, 128)

in expression starting at /home/jiricvrk/Julia/tipy.jl:20

throw\_inexacterror(::Symbol, ::Any, ::Int64) at boot.jl:567

checked\_trunc\_sint at boot.jl:589 [inlined]

toInt8 at boot.jl:604 [inlined]

Type at boot.jl:714 [inlined]

convert at number.jl:7 [inlined]

setindex!(::Array{Int8,2}, ::Int64, ::Int64, ::Int64) at array.jl:771

top-level scope at tipy.jl:52

include\_string(::Module, ::String, ::String) at loading.jl:1008

(::getfield(Atom, Symbol(“##129#135”)){String,String,Module})() at eval.jl:125

withpath(::getfield(Atom, Symbol(“##129#135”)){String,String,Module}, ::String) at utils.jl:30

withpath at eval.jl:46 [inlined]

#128 at eval.jl:122 [inlined]

with\_logstate(::getfield(Atom, Symbol(“##128#134”)){String,String,Module}, ::Base.CoreLogging.LogState) at logging.jl:395

with\_logger at logging.jl:491 [inlined]

#127 at eval.jl:121 [inlined]

hideprompt(::getfield(Atom, Symbol(“##127#133”)){String,String,Module}) at repl.jl:85

macro expansion at eval.jl:120 [inlined]

(::getfield(Atom, Symbol(“##126#132”)){Dict{String,Any}})() at task.jl:85

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 30, 2018, 10:39am UTC](https://discourse.julialang.org/t/beginner-loaderror-inexacterror-trunc-when-convert-dataframe/18151/2 "2018-11-30T10:39:38Z")

</div>

Please read [Please read: make it easier to help you](https://discourse.julialang.org/t/psa-make-it-easier-to-help-you/14757), and try to produce an MWE (minimum working example) of your code, to make it easier for others to help you.

From what you posted it appears that your code is trying to convert the number 128 into an `Int8` format, which is failing as `Int8` only supports the range from -128 to 127 (see the docs [here](https://docs.julialang.org/en/v1/manual/integers-and-floating-point-numbers/index.html) for more explanation of the different number types).

It is hard to say how you should modify your code without knowing what you are actually trying to do.

---

<div class="post-metadata">

### Author: ![xaver](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xaver](https://discourse.julialang.org/u/xaver)
#### Post date: [November 30, 2018, 5:02pm UTC](https://discourse.julialang.org/t/beginner-loaderror-inexacterror-trunc-when-convert-dataframe/18151/3 "2018-11-30T17:02:11Z")

</div>

Thank you very much for reply.  
When I started to prepare sample, I found the error 🙂

I have defined an array

```julia
dbtip = zeros(Int8,howm,11) #row length 11!!

```

that was the problem when I have more data…  
I changed it to

```julia
dbtip = zeros(Int16,howm,11) #row length 11!!

```

and code is working. I would like define in following manner: first six elements in row INT8 and next 5 INT16 in the future. It should be possible, shouldn’t it?

Best regards…
