I've been trying to rename a bunch of columns in a DataFrame and as a former pandas user am a bit thrown off by the way columns are accessed using symbols. Let's say I have a list of column names (strings) which I want to all give the same name with ascending integers at the end. After a few unsuccesful attempts, I came up with the following, but I feel like there has to be a less ugly way of doing this:
df = DataFrame(A = rand(5), B = rand(5), C = rand(5), D = rand(5)) varlist = ["B", "C"] for i = 1:length(varlist) rename!(df, convert(Symbol, varlist[i])), convert(Symbol, "column_"*string(i)) end
