String column dataframe: replace for another string built from a substring from each row

First, please update DataFrames.jl to 0.22 release to get the latest and bug free functionality.

Now regarding your code the simple transformation is (it assumes that DRE contains ONLY ASCII digits):

transform!(df, :DRE => ByRow(x -> "20"*x[2:3]) => :DRE)

or a general solution that correctly handles all UNICODE characters but is a bit verbose:

transform!(df, :DRE => ByRow(x -> "20"*last(first(x, 3), 2)) => :DRE)
4 Likes