I'm sorry that my example is not good to explain what I want to do. I tried to count up words and get top N frequent words and I referred to following example.
https://github.com/JuliaLang/julia/blob/master/examples/wordcount.jl I don't think it should return Dict for top N words, so I think DataFrame is good to get top N words using head(). But I wonder if DataFrame isn't suitable because DataFrame converted from Dict is not sortable style using its values of Dict. On Sat Dec 06 2014 at 11:24:02 Steven G. Johnson <[email protected]> wrote: > > > On Friday, December 5, 2014 9:57:28 AM UTC-5, Michiaki Ariga wrote: >> >> I found there are no method such as sort_by() after v0.3. >> But I want to count word frequency with Dict() and sort by its value to >> find frequent word. >> So, how can I sort Dict efficiently? >> > > You may want to use a different data structure. For example, you can > store word frequencies in a PriorityQueue and then pull out the most > frequent word with peek or dequeue. See: > > http://julia.readthedocs.org/en/latest/stdlib/collections/ > > (A PriorityQueue lets you quickly fetch the smallest value, whereas you > want the largest frequency, but you can work around this by just storing > frequency * -1.) > > If you need all of the values in order, you can instead use an OrderedDict > from https://github.com/JuliaLang/DataStructures.jl >
