#Use a column name as a function argument to then modify that column
1 messages · Page 1 of 1 (latest)
You could manipulate expressions with macros.
But you need to interpolate them.
But in this case, what you need is the getattr...
Maybe try...
replace!(getfield(df, col_name), missing=>99)?
Though getfield isn't used quite often.
In that case... can you turn the string into the symbol?
Or...
another way... there might be a way to index the dataframe using name.
df[col_names]?
df[!, col] -> the vector contained in column col returned without copying; the same as df.col if col is a valid identifier.
The docs say this way.
Oh, you can index with an arbitrary type!
And since "!" is a function!
Julia doesn't fail to impress me.