Stream: helpdesk (published)

Topic: Method Error: objects of type Module are not callable


view this post on Zulip QuBit (Jul 13 2021 at 22:06):

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?

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:07):

StableRNGs(78) should probably be StableRNG(78)?

view this post on Zulip QuBit (Jul 13 2021 at 22:11):

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?

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:13):

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.

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:28):

What do you mean there is no stacktrace?

view this post on Zulip QuBit (Jul 13 2021 at 22:33):

Fredrik Ekre

Are you asking me to share the event-log or call-stack
in the REPL or the log from Inspect Element (F12)?

In PLuto.jl I am not sure where to find the stack-trace.
This is so you can see how the events are handled?

In the running processes, or execution cells, there are
only the error, messages. Some more verbose than others.

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:35):

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]

view this post on Zulip QuBit (Jul 13 2021 at 22:40):

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

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:41):

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

view this post on Zulip QuBit (Jul 13 2021 at 22:42):

Fredrik Ekre

I did not, was only testing out other approaches.

view this post on Zulip Fredrik Ekre (Jul 13 2021 at 22:43):

Ok

view this post on Zulip QuBit (Jul 13 2021 at 23:25):

Solved:

Convert RugratsDF to array via:

Array(RugratsDF[1:15, :])
.
.
.

Last updated: Oct 02 2023 at 04:34 UTC