DataFrames: convert column data type

Your second line do not change dataframe.

julia> df = DataFrame(B = [23])
1×1 DataFrame
 Row │ B
     │ Int64
─────┼───────
   1 │    23

julia> string.(df[!,:B])
1-element Vector{String}:
 "23"

julia> df[!, :B]
1-element Vector{Int64}:
 23

If you want to make a change, you should reassign column

julia> df[!, :B] = string.(df[!,:B])
1-element Vector{String}:
 "23"

julia> df[!, :B]
1-element Vector{String}:
 "23"

Of course, Int. is not working anymore

julia> Int.(df[!,:B])
ERROR: MethodError: no method matching Int64(::String)

5 Likes