Something like this:

julia> df = DataFrame(x = Int[1:10; typemax(Int8)]);

julia> eltype(df[:x])
Int64

julia> df[:x] = Int8[df[:x]...];

julia> eltype(df[:x])
Int8

julia> df = DataFrame(x = Int[1:10; typemax(Int8) + 1]);

julia> eltype(df[:x])
Int64

julia> df[:x] = Int8[df[:x]...];
ERROR: InexactError()
 in getindex at array.jl:167



You get the error for free!

El jueves, 24 de diciembre de 2015, 5:02:14 (UTC-6), Min-Woong Sohn 
escribió:
>
> I want to reduce the amount of memory used by a dataframe that has lots of 
> binary variables. What is the best way to achieve this? For example, how 
> can I convert a variable from Int64 to Int8 in a dataframe.
>
> Thanks
>

Reply via email to