rename!(f::Function, df) is not really convenient as f normally has to convert column names to string, operate on a string and convert it back to Symbol.
Two ideas:
rename! to assume that f takes a string a returns a string and Symbol unwrapping/wrapping happens automaticallyrename! that would allow the user to choose if f is from string to string or from Symbol to SymbolAt least we could allow returning a string in addition to a symbol. Not sure about converting the argument to string before passing it, as it would be inconsistent with the fact that we use symbols everywhere.
Actually in this case the change could be quite small and non breaking - we can simply cast whatever is returned by f to Symbol (or restrict casting only to AbstractString).
Would also be great to be able to do pairs of Int=>Symbol so that one can rename columns by index rather than name. I'm often in a situation where I need to rename the first column of a bunch of tables where I don't necessarily know the name. So something like rename(df, 1=>:a) and rename(df, [1=>:a, 2=>:b])
Now we allow string or Symbol as "oldcol", do we still want to add integers?
Why not, if somebody wants to implement that...
I have opened https://github.com/JuliaData/DataFrames.jl/pull/2030 for this (as the docstrings for rename and rename! needed decoupling and a clean-up anyway).
all is done here. closing.