I am trying to convert dataframe columns from string to int to boolean using a loop. I have confirmed that n does correctly catch the df column names but am unable to reference them in the convert statement.
for n in (names(df))
df[!,:n] = convert.(Bool, (parse.(Int,df[!,:n])))
end
The error I get is:
ERROR: LoadError: ArgumentError: column name :n not found in the data frame
:nis a symbol and is not referring tonin your loopfor n in ..., to refer tonusennot:n, i.e. the second line should bedf[!,n] = convert.(Bool, (parse.(Int,df[!,n]))).