StatsBase.countmap for iterator not working? `countmap(i for i in 1:10)`

Hey community :smiley:

julia> using StatsBase

julia> countmap(i for i in 1:10)
ERROR: MethodError: no method matching countmap(::Base.Generator{UnitRange{Int64},typeof(identity)})
Closest candidates are:
  countmap(::AbstractArray{T,N} where N; alg) where T at C:\Users\<user>\.julia\packages\StatsBase\unDUx\src\counts.jl:389
  countmap(::AbstractArray{T,N} where N, ::AbstractArray{W,1}) where {T, W<:Real} at C:\Users\<user>\.julia\packages\StatsBase\unDUx\src\counts.jl:390
Stacktrace:
 [1] top-level scope at REPL[11]:1

Can you update StatsBase? It works for me:

(@v1.5) pkg> status StatsBase
Status `~/.julia/environments/v1.5/Project.toml`
  [2913bbd2] StatsBase v0.33.2

julia> countmap(i for i in 1:10)
Dict{Any,Int64} with 10 entries:
  7  => 1
  4  => 1
  9  => 1
  10 => 1
  2  => 1
  3  => 1
  5  => 1
  8  => 1
  6  => 1
  1  => 1
2 Likes

Awesome :heart_eyes: love Julia

2 Likes