【发布时间】:2022-01-19 07:35:44
【问题描述】:
| Volume | f | Explanation |
|---|---|---|
| 10 | 0 | no volume before 10 |
| 7 | 0 | no smaller volume before 7 |
| 13 | 2 | Both 10 and 7 are smaller than 13 |
| 6 | 0 | 13 is larger than 6 |
| 4 | 0 | 6 is larger than 4 |
| 8 | 2 | Both 6 and 4 are smaller than 8 |
| 7 | 0 | 8 is larger than 7 |
| 3 | 0 | 7 is larger than 3 |
| 4 | 1 | 3 is smaller than 4 |
如上表所示,我想在 DolphinDB 中根据体积获取 f 列。 假设当前卷为 t,期望输出 f 为满足以下条件的卷数:
- volume 列中有连续的元素小于 t
- 连续元素的最后一卷是前一卷 在 t 之前;
详细的计算原理在说明栏中有说明。
我尝试了 for-loop,但它不起作用。 DolphinDB 是否支持任何其他函数来获取结果?
【问题讨论】: