Having problems to modifying a DataFrame using a for loop and eachcol

Like in any Julia code, col = ... will just assign a new value to identifier col, but won’t mutate the original value that col pointed to. Use mapcols! instead:

mapcols!(df) do col
    [parse.(Float64, x) for x in split.(col ," ")]
end
3 Likes