3

Edit: countmap() is in StatsBase.jl and is working as expected. I'm not sure how to change this to an answered problem or if I should I delete it.

using DataFrames
using CSV

train = DataFrame(CSV.File("training.csv"))
countmap(train.column)



UndefVarError: countmap not defined

Stacktrace:
 [1] top-level scope
   @ In[40]:1
 [2] eval
   @ .\boot.jl:360 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base .\loading.jl:1094

I get that error running the code. Was countmap deprecated at some point and I just cannot find any updates about it or am I missing something?

0

2 Answers 2

4

Are you looking for countmap from the StatsBase.jl package?

Sign up to request clarification or add additional context in comments.

Comments

4

You can use the following pattern to get a DataFrame instead of a Dict as a result:

combine(groupby(train, :column), nrow)

(in many cases it will be much faster than countmap)

Also instead of:

DataFrame(CSV.File("training.csv"))

it is more efficient to write:

CSV.read("training.csv", DataFrame)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.