I have a very long DataArray of rows, and I would like to create a DataFrame in which one column is all unique rows and the second is the number of occurrences. Right now i'm doing something like
using DataFrames df = DataFrame() df[:B]=[ "a", "c", "c", "D", "E"] uniqueB = unique(df[:B]) println(uniqueB) howMany=zeros(size(uniqueB)) for i=1:size(uniqueB,1) howMany[i] = count(j->(j==uniqueB[i]), df[:B]) end answer = DataFrame() answer[:Letters] = uniqueB answer[:howMany] = howMany answer
but it seems that there should be a much simpler way to do this, possibly with a single line. (I know that I could do this a little faster with a bit more code, looking for the result at each iteration, and not at the source.) Perhaps the related question is here , but it doesn't seem like the histogram is overloaded for non-numeric bunkers. Any thoughts?
julia-lang
ARM
source share