An unexpected result using DataFrames.jl

Hi! Following JuliaAcademy, I had found something that results confusing.

using DataFrames, Random

function sim_e()
    draw = Float64[]
    while true
        push!(draw, rand())
        sum(draw) > 1.0 && return draw

res = [sim_e() for _ in 1:5]


@. sum(res) - last(res)

df = DataFrame()

@time for i in 1:10^7
    push!(df, (id=i, pos=sim_e()))


transform!(df, :pos => ByRow(length) => :jumps)

This code has to deliver the following, according to the tutorial:
However, I obtain this error message:

Which is nonsense considering that I have been using DataFrames.jl during the course.
Did I do something wrong?

Works for me - are you sure you’re on the latest version of DataFrames?

I am using DataFrames v0.20.2.

Can you run import Pkg; Pkg.update()? The latest version is v0.21.0. All those fun things are defined only for the newest version of DataFrames.

Don’t think that will work given the output of pkg> up above - something might be holding you back, try add DataFrames@0.21 to see what’s restricting the DataFrames version.

1 Like

good call. OP should probably start their own environment for the julia academy tutorial. but that’s a bit scary for a new comer. This is unfortunate.

If you use ODBC, that holds DataFrames back at v0.20.2 at the moment.

Hi! Thanks for your answer. Following your suggestion, this message appears:

Okay so you can do ]rm MLJ to remove MLJ (if you don’t need it now!) - MLJ currently restricts compatibility to DataFrames below 0.21 so won’t let you update.

OP, the way to really avoid this problem is to create a new folder and use julia to cd into it. Then run import Pkg; Pkg.activate(".").

After that, add all the packages you need to get through the JuliaAcademy course.

So something like this, which you only need to run once.

import Pkg
# add other packages

Then if you close and re-open your julia terminal, you just need to do set Julia to the folder above and run import Pkg; Pkg.activate(".").

If this is too complicated, don’t worry about it. You can just focus on removing MLJ like the poster above mentioned and trying to update DataFrames again.

1 Like

Thanks for your support. The problem looks fixed. The downside is that now appears these messages that I encountered a bit difficult to understand by the time to using Statistics and GLM.

What does it mean?

These should all be fine as long as the code works. I couldn’t explain what all of them mean, though.

They shouldn’t worry you - and also they should go away once you restart Julia.

1 Like