Struggling to migrate from R (dplyr) to Julia (DataFrameMeta)

hello dear julia developers
i’m new to julia and i’m fascinated by the power and performance of this great language
i’m trying to convert my notebooks in R to Julia to help me learn it but the issue is that i’m stuck with a small issue
i have a dataframe that i need to select all columns except few ones

@select df $(Not([:Label, :Local]))

but i always get this error message

ArgumentError: Expressions not of the form `y = f(:x)` are currently disallowed.

despite that i followed exactly what is written in the documentations

What version are you on? I am having trouble recreating the error.

1 Like

On DataFramesMeta.jl 0.13 what you write works:

julia> using DataFramesMeta

julia> df = DataFrame(rand(2, 4), :auto)
2×4 DataFrame
 Row │ x1        x2        x3        x4
     │ Float64   Float64   Float64   Float64
─────┼────────────────────────────────────────
   1 │ 0.693758  0.948115  0.731398  0.616161
   2 │ 0.691157  0.913739  0.557192  0.368638

julia> @select df $(Not([:x2, :x4]))
2×2 DataFrame
 Row │ x1        x3
     │ Float64   Float64
─────┼────────────────────
   1 │ 0.693758  0.731398
   2 │ 0.691157  0.557192

(you are probably aware that in this case you can also just write select(df, Not([:Label, :Local])?)

1 Like

thank you for the response dear @bkamins
i’m at version 0.7.1, i will try to update DataFramesMeta
btw, i’m very fan of you and i started learning watching your tutorials :smiley:

1 Like

thank you for the response dear @adienes
i’m at version 0.7.1

it seems like the issue is related to the outdated package of DataFramesmeta, i tried to upgrade it but i failed and i received an error related to some precompiled packages or something

Do:

]add DataFramesMeta.jl@0.13

and show us the output. The error will tell you where the issue is.

2 Likes

i’m so sorry for bothering you all, but this is what i got unfortunately
i think tensorflow is the cause of the issue

ERROR: Unsatisfiable requirements detected for package DataFrames [a93c6f00]:
 DataFrames [a93c6f00] log:
 ├─possible versions are: 0.11.7-1.5.0 or uninstalled
 ├─restricted to versions * by an explicit requirement, leaving only versions 0.11.7-1.5.0
 ├─restricted by compatibility requirements with DataFramesMeta [1313f7d8] to versions: 1.0.0-1.5.0
 │ └─DataFramesMeta [1313f7d8] log:
 │   ├─possible versions are: 0.4.0-0.13.0 or uninstalled
 │   └─restricted to versions 0.13 by an explicit requirement, leaving only versions 0.13.0
 └─restricted by compatibility requirements with Compat [34da2185] to versions: 0.11.7-0.21.8 or uninstalled — no versions left
   └─Compat [34da2185] log:
     ├─possible versions are: 1.0.0-4.6.0 or uninstalled
     └─restricted by compatibility requirements with TensorFlow [1d978283] to versions: 1.0.0-2.2.1
       └─TensorFlow [1d978283] log:
         ├─possible versions are: 0.10.2-0.11.0 or uninstalled
         └─restricted to versions * by an explicit requirement, leaving only versions 0.10.2-0.11.0

From the log we can see that the problem is GitHub - malmaud/TensorFlow.jl: A Julia wrapper for TensorFlow package. I recommend you remove it from your global project (you can still use it in a separate project).

The reason is that last release of this package was in 2019 and it is currently significantly outdated. Most of the packages (not only DataFramesMeta.jl) will not work correctly when TensorFlow.jl is installed.

I even see on its website that its developer recommends switching to Flux.jl.

5 Likes

thank you so much sir, it looks like TensorFlow and Torch were holding the updates for many packages and after removing them all packages got updated successfully

1 Like

My advice is not to put anything substantive into the global environment. It should contain only a few packages useful for things like debugging. Such as Revise or Infiltrator or similar. Any substantive package for a project should go in an environment for that project.

1 Like