'dummy variable encoding or one-hot encoding from Monday to Friday based on datetime with DolphinDB
Solution 1:[1]
Through the dayOfWeek(), you can get what day of the week the current date is, and then judged by iif, you can construct a 5-column sparse matrix (one-hot encoding)
for(i in 1:6)
{
outputTable["DW"+i] = iif(outputTable.interval_date_time.dayOfWeek()==i,1,0)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | damie |


