Hello,
I have a dataframe and I would like to change all the names at once. I can change the name of a single column following this script, but what is the syntax for the whole lot?
I have tried giving an array of names as input and one as output, but did not work:
julia> df=DataFrame(c1=[1,2,3],c2=[3,4,5])
3×2 DataFrame
Row │ c1 c2
│ Int64 Int64
─────┼──────────────
1 │ 1 3
2 │ 2 4
3 │ 3 5
julia> rename!(df,[:c1, :c2] => [:a,:b])
ERROR: MethodError: no method matching rename!(::DataFrame, ::Vector{Pair{Vector{Symbol}, Vector{Symbol}}})
Closest candidates are:
rename!(::AbstractDataFrame, ::AbstractVector{Symbol}; makeunique) at ~/.julia/packages/DataFrames/JZ7x5/src/abstractdataframe/abstractdataframe.jl:197
rename!(::AbstractDataFrame, ::AbstractVector{<:AbstractString}; makeunique) at ~/.julia/packages/DataFrames/JZ7x5/src/abstractdataframe/abstractdataframe.jl:203
rename!(::AbstractDataFrame, ::AbstractVector{Pair{Symbol, Symbol}}) at ~/.julia/packages/DataFrames/JZ7x5/src/abstractdataframe/abstractdataframe.jl:209
...
Stacktrace:
[1] rename!(df::DataFrame, args::Pair{Vector{Symbol}, Vector{Symbol}})
@ DataFrames ~/.julia/packages/DataFrames/JZ7x5/src/abstractdataframe/abstractdataframe.jl:235
[2] top-level scope
@ none:1