hi,
I have a simple dataframe
csv_file = ["MARY","PATRICIA","LINDA","BARBARA","ELIZABETH","JENNIFER","MARIA","SUSAN","MARGARET","DOROTHY","LISA","NANCY","KAREN","BETTY"]
df = DataFrame(NAMES=sort(csv_file))
I then want to transform (add a column that is based on the first column in the df,
###Takes the letters in the string and counts them up
function count_char(n::String)
foldr(+,[Int(i)-64 for i in n])
end
But if I do this, I get an error:
@transform df begin
:NAMES_NUMBER = count_char(:NAMES)
end
ERROR: LoadError: MethodError: no method matching Int64(::String)
Closest candidates are:
Int64(::Union{Bool, Int32, Int64, UInt32, UInt64, UInt8, Int128, Int16, Int8, UInt128, UInt16}) at boot.jl:708
Int64(::Ptr) at boot.jl:718
Int64(::Float32) at float.jl:706
I thought maybe its the function itself so I took a base function that should work on this:
@transform df begin
:NAMES_NUMBER = lowercase(:NAMES)
end
ERROR: LoadError: MethodError: no method matching lowercase(::Array{String,1})
Closest candidates are:
lowercase(::T) where T<:AbstractChar at strings/unicode.jl:245
lowercase(::AbstractString) at strings/unicode.jl:531
I am new to dataframes so I think that is the reason. Could someone explain the essence behind this error (i assume they are the same, if not please correct me).
thanks!