"Re-infer" container eltype

#1

I have a container, e.g. a DataFrame, where a column eltype is more general than the actual type of values:

using DataFrames, Query

df = DataFrame(a = [[1], [2], [1 2; 3 4]])
df = df |> @filter(ndims(_.a) == 1) |> DataFrame
eltype(df[:a])
# Array{Int64,N} where N

And if I want the eltype to be concrete and match the actual content, splatting works: eltype([df[:a]...]) == Array{Int64,1}. However it is inefficient, so is there any other way to force “re-inferring” of an eltype?

0 Likes