Hello Everyone:
Might you all know how to approach the following problem:
x = RugratsDF[1:15, :]
y = Rugrats[16:16, :]
rng = StableRNGs(78)
train, test = partition(eachindex(y), 0.8, shuffle=true, rng=rng)
test[1:5]
Is returning the following error:
MethodError: objects of type Module are not callable
Any suggestions out there?
StableRNGs(78)
should probably be StableRNG(78)
?
Fredrik Ekre
Thought so also, but the package name
I imported was 'StableRNGs'. When I make
the change you suggest, I get:
MethodError: no method matching keys(::DataFrames.DataFrame)
Thoughts?
but the package name I imported was 'StableRNGs'
Yes, but you can't use package names like functions.
When I make the change you suggest, I get ...
Perhaps dataframes does not support eachindex
? Difficult to know whats wrong when you don't post the stacktrace.
What do you mean there is no stacktrace?
The stacktrace usually contain information about where the error originates from and is crucual when trying to debug something. I tried just now in Pluto and I see a stacktrace:
MethodError: no method matching keys(::DataFrames.DataFrame)
Closest candidates are:
keys(!Matched::Union{Tables.AbstractColumns, Tables.AbstractRow}) at /home/fredrik/.julia/packages/Tables/gg6Id/src/Tables.jl:181
keys(!Matched::DataFrames.GroupedDataFrame) at /home/fredrik/.julia/packages/DataFrames/vQokV/src/groupeddataframe/groupeddataframe.jl:839
keys(!Matched::IOContext) at show.jl:344
...
1. eachindex(::DataFrames.DataFrame) @ abstractarray.jl:253
2. top-level scope @ Local: 1[inlined]
Fredrik Ekre
Did you test the original code I shared?
If so, what was the stacktrace for that?
Because on my machine, it only reads :
MethodError: objects of type Module are not callable
No I didn't, but I thought you already fixed that error? https://julialang.zulipchat.com/#narrow/stream/274208-helpdesk-.28published.29/topic/Method.20Error.3A.20objects.20of.20type.20Module.20are.20not.20callable/near/245895869
Fredrik Ekre
I did not, was only testing out other approaches.
Ok
Solved:
Convert RugratsDF to array via:
Array(RugratsDF[1:15, :])
.
.
.
QuBit has marked this topic as resolved.
Last updated: Nov 06 2024 at 04:40 UTC