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?
Are you looking for countmap from the StatsBase.jl package?
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With