Package DataFramesMeta looks very useful. I gave it a try and some things did not work. The following example, copied from [Introduction · DataFramesMeta Documentation], was tried in a new Julia session in an environment where the packages DataFrames and DataFramesMeta had been previously added.
using DataFrames
using DataFramesMeta
df = DataFrame(x = [1, 1, 2, 2], y = [1, 2, 101, 102])
@select(df, :x, :y) # Works fine
4×2 DataFrame
Row │ x y
│ Int64 Int64
─────┼──────────────
1 │ 1 1
2 │ 1 2
3 │ 2 101
4 │ 2 102
@select(df, :x2 = 2 * :x, :y)
ERROR: LoadError: ArgumentError: This path should not be reached
Stacktrace:
[1] fun_to_vec(ex::Expr; nolhs::Bool, gensym_names::Bool, wrap_byrow::Bool)
@ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\parsing.jl:302
[2] (::DataFramesMeta.var"#30#31"{Bool})(ex::Expr)
@ DataFramesMeta .\none:0
[3] iterate(::Base.Generator{Vector{Any}, DataFramesMeta.var"#30#31"{Bool}})
@ Base .\generator.jl:47
[4] select_helper(::Symbol, ::Expr, ::Vararg{Any})
@ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\macros.jl:976
[5] var"@select"(__source__::LineNumberNode, __module__::Module, x::Any, args::Vararg{Any})
@ DataFramesMeta C:\Users\fsald\.julia\packages\DataFramesMeta\z0mc6\src\macros.jl:1078
in expression starting at REPL[10]:1
Then I did an ] update for the packages in the project. Checked again and the line in Project.toml had not changed. I tried to run the code and got the same error message.
Yes - so as you can see you have DataFramesMeta.jl 0.7.1 installed and the current version is 0.10.0. Please do ]add DataFramesMeta@0.10 to see what is holding back the update of the package to its latest version.
I tried what you suggested with versions 0.10.1, 0.10.0 and 00.11.7 and did not work. Here is what I got:
(BW1) pkg> add DataFramesMeta@0.10.1
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
DataFramesMeta [1313f7d8] log:
├─possible versions are: 0.4.0-0.10.0 or uninstalled
└─restricted to versions 0.10.1 by an explicit requirement — no versions left
(BW1) pkg> add DataFramesMeta@0.10.0
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
DataFrames [a93c6f00] log:
├─possible versions are: 0.11.7-1.3.2 or uninstalled
├─restricted to versions * by an explicit requirement, leaving only versions 0.11.7-1.3.2
├─restricted by compatibility requirements with DataFramesMeta [1313f7d8] to versions: 1.0.0-1.3.2
│ └─DataFramesMeta [1313f7d8] log:
│ ├─possible versions are: 0.4.0-0.10.0 or uninstalled
│ └─restricted to versions 0.10.0 by an explicit requirement, leaving only versions 0.10.0
└─restricted by compatibility requirements with Lathe [38d8eb38] to versions:
0.11.7-0.22.7 — no versions left
└─Lathe [38d8eb38] log:
├─possible versions are: 0.0.3-0.1.8 or uninstalled
└─restricted to versions * by an explicit requirement, leaving only versions 0.0.3-0.1.8
(BW1) pkg> add DataFramesMeta@0.11.7
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
DataFramesMeta [1313f7d8] log:
├─possible versions are: 0.4.0-0.10.0 or uninstalled
└─restricted to versions 0.11.7 by an explicit requirement — no versions left
It tells you exactly what’s going wrong - you are using Lathe, a package which hasn’t been updated in a long time and is restricted to using a very old DataFrames version (0.22). Given that DataFramesMeta is developed based on the stable, post 1.0 API of DataFrames, all recent DataFramesMeta versions require DataFrames post 1.0.
Thanks. I removed package Lathe and that solved the problem. Now the DataFramesMeta code of the original post works.
After a ] update I also saw that the version of the DataFrames package changed to 1.3.2.
The only caveat is that I was only able to install version 0.10.0 of DataFramesMeta. When I tried to install version 0.10.1 I got a short message that does not specify the reason for not installing:
(BW1) pkg> add DataFramesMeta@0.10.1
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package DataFramesMeta [1313f7d8]:
DataFramesMeta [1313f7d8] log:
├─possible versions are: 0.4.0-0.10.0 or uninstalled
└─restricted to versions 0.10.1 by an explicit requirement — no versions left