JuliaDB: How to modify multiple existing columns with setcol using functions

juliadb

#1

Hi, I am trying to modify several existing columns with one call to setcol using functions. Essentially I have a table where i need to divide 4 of the columns by 10 to get the proper value.

I know this is the proper syntax for modifying ONE column:
setcol(tbl, :TMAX, :TMAX => t -> t / 10)

However, I need to do something like:
setcol(tbl, :TMAX => t -> t / 10, :TMIN => t -> t / 10)

Any suggestions?


#2

So this solution worked, but I don’t know if there is anything more efficient (esp if you want to apply the same function to multiple columns.

setcol(tbl, :TMAX => :TMAX => t -> t / 10, :TMIN => :TMIN => t -> t / 10, :TAVG => :TAVG => t -> t / 10, :PRCP => :PRCP => t -> t / 10)