Call a constructor by interpolation

Dataframe has a constructor DataFrame(column_eltypes, names), so you can do

julia> nm = ["mystrings", "myints"];

julia> tps = [String, Int64];

julia> df = DataFrame(tps, nm);

julia> names(df)
2-element Array{String,1}:
 "mystrings"
 "myints"

I didn’t use eval above because I think it’s a bad idea. Is there any reason why you think it would be necessary in order to do what you’re trying to do?

1 Like