I have been struggling with a dataframe loaded in from Feather.jl when I try to do a by
using Feather,DataFrames, DataFramesMeta, CategoricalArrays
a = Feather.read("some_file.feather")
# the below fails
aaa = by(a, :some_col, df -> sum(df[:some_val]))
it gives an error
MethodError: Cannot convert
an object of type String to an object of type CategoricalArrays.CategoricalValue{String,Int32}
The type information is as per below
typeof(a)
# DataFrames.DataFrame
typeof(a[:some_col])
# CategoricalArrays.NullableCategoricalArray{String,1,Int32}
typeof(a[:some_val])
# NullableArrays.NullableArray{Float64,1}
The documentation for CategoricalArrays doesn't contain a lot of documentation on working with DataFrames (nor should it I guess)
However I tried to replace the column with a test value then the by works.
a[:some_col] = ["Testing" for i in 1:nrow(a)]
#this works
by(a,:some_col, df -> sum(df[:some_val]))
so it must be something wrong with CategoricalArrays. But I can't figure out how to do this simple summary. Please help