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
end
end
Random.seed!(1234);
res = [sim_e() for _ in 1:5]
sum.(res)
@. sum(res) - last(res)
df = DataFrame()
@time for i in 1:10^7
push!(df, (id=i, pos=sim_e()))
end
df
transform!(df, :pos => ByRow(length) => :jumps)
This code has to deliver the following, according to the tutorial:
However, I obtain this error message:
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.
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.
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
mkdir("JuliaAcademyCourse")
cd("JuliaAcademyCourse")
Pkg.activate(".")
Pkg.add("DataFrames")
# 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.
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.