I am trying to rename the dataframe columns using the below code-
function _process_col(df)
for col in names(df)
print(col)
rename!(df, :col => _clean_col_name(col))
end
return df
end
But is throws error that col is not present in the dataframe. rename!(df, :col => _clean_col_name(col)) is treating col as string not as a variable.
note - _clean_col_name(col) is a custom function to process the column name
Is there any alternative to do this??