You can use StatsBase for this
julia> using StatsBase
julia> result = fit(Histogram, randn(1000))
StatsBase.Histogram{Int64,1,Tuple{FloatRange{Float64}}}
edges:
-4.0:1.0:4.0
weights: [2,24,131,361,342,129,10,1]
closed: right
Replace the randn(1000)
in the code above with the vector your are working with.
You can access the properties of the result using result.edges
and result.weights
.
See http://statsbasejl.readthedocs.io/en/latest/empirical.html