How to rename multiple columns?

19 views Asked by At

Suppose a function returns two columns of vectors. I want to aggregate the results of this function into a table and rename each column. I now use table(t1.event_time as event_time, sr(t,4,4,9) as t4d4, sr(t,10,4,9) as t10d10), but it fails to rename the columns and reports an error indicating repetitive column names. Though this issue can be solved by extracting each vector and respectively writing them into the table, I wonder if there is an easier way.

1

There are 1 answers

0
JaneYe On

You can use the rename! function to rename the columns. Though in SQL, select f(a) as ab can be used to rename columns, "as" does not work in DolphinDB’s table function when it takes functions as parameters. enter image description here