sisl/ngsim_env

julia convert_raw_ngsim_to_trajdatas() got error "no method matching rename!(::DataFrames.Index, ::Symbol, ::Symbol)"

ViviXiang opened this issue · 3 comments

I follow the instrcutions in https://github.com/sisl/ngsim_env/blob/0.7fixes_in_progress/docs/install_env_gail_full.md

and I got an error when executing :
##Create trajectories from the data
$julia
julia> using NGSIM
julia> convert_raw_ngsim_to_trajdatas()

The output is:
converting i101_trajectories-0750am-0805am.txt
loading from file: ┌ Warning: readtable is deprecated, use CSV.read from the CSV package instead
│ caller = ip:0x0
└ @ Core :-1
ERROR: MethodError: no method matching rename!(::DataFrames.Index, ::Symbol, ::Symbol)
Closest candidates are:
rename!(::DataFrames.Index, ::Any) at /home/vivi/.julia/packages/DataFrames/m9gd9/src/other/index.jl:49
rename!(::DataFrames.AbstractDataFrame, ::Any...) at /home/vivi/.julia/packages/DataFrames/m9gd9/src/abstractdataframe/abstractdataframe.jl:127
rename!(::DataFrames.Index, ::Pair{Symbol,Symbol}...) at /home/vivi/.julia/packages/DataFrames/m9gd9/src/other/index.jl:60
Stacktrace:
[1] rename!(::DataFrames.DataFrame, ::Symbol, ::Symbol) at /home/vivi/.julia/packages/DataFrames/m9gd9/src/abstractdataframe/abstractdataframe.jl:127
[2] NGSIMTrajdata(::String) at /home/vivi/.julia/packages/NGSIM/OPF1x/src/ngsim_trajdata.jl:37
[3] #load_ngsim_trajdata#35(::Bool, ::Function, ::String) at /home/vivi/.julia/packages/NGSIM/OPF1x/src/trajdata.jl:146
[4] load_ngsim_trajdata at /home/vivi/.julia/packages/NGSIM/OPF1x/src/trajdata.jl:145 [inlined]
[5] convert_raw_ngsim_to_trajdatas() at /home/vivi/.julia/packages/NGSIM/OPF1x/src/trajdata.jl:200
[6] top-level scope at none:0

It seems like there exists no such rename fnuctions from the loaded modules.
Can somebody help me with this issue?

djp42 commented

Hi ViviXiang,

Thanks for the question! Which version of Julia are you using? Alternatively, there might be a broken dependency in the DataFrames / NGSIM package.

The most up-to-date DataFrames has a different renaming function than the one NGSIM seems to call, according to julia wikibooks. It seems like it should be rename!(df, :old => :new) instead of rename!(df, :old, :new) at ngsim_trajdata.jl:37. The NGSIM package lives here: . Please start an issue there if we know it isn't ngsim_env specific.

Action items for you:

  • Try changing line 37 as above and see if it solves your issue. Let me know if it does or does not.
  • Open a new issue in the NGSIM repository with the result of your changes. Be sure to include your julia version.

CC: @MaximeBouton - does the above sound reasonable?

@djp42 Using rename!(df, :old => :new) instead of rename!(df, :old, :new) at [ngsim_trajdata.jl:37] really helps, thanks very much for your help.

Could you maybe submit a PR or restrict the version of dataframes?