empirical-lang - 为什么“asof”连接不能既是“最近的”又是“严格的”?
问题描述
通过演示,为什么Empirical禁止以下?
>>> join trades, events on symbol asof timestamp nearest strict
Error: join 'asof' cannot be both 'nearest' and 'strict'
有没有办法匹配最接近但不准确的时间戳?
解决方案
这是不允许的,因为匹配的行可能是乱序的。想象一下这个设置:
data LeftItem: time: Time, code1: Char end
data RightItem: time: Time, code2: Char end
let left = !LeftItem([Time("09:30"), Time("09:31")], ['A', 'B'])
let right = !RightItem([Time("09:30"), Time("09:31")], ['a', 'b'])
我们现在有这些数据框:
>>> left
time code1
09:30:00 A
09:31:00 B
>>> right
time code2
09:30:00 a
09:31:00 b
如果有一个“最近的严格”,那么结果将是
time code1 code2
09:30:00 A b
09:31:00 B a
从某种意义上说,这是正确的,因为我们有不准确的最接近的行,但这没有任何意义。我们期望时间单调增加,所以匹配的行不应该是倒序的。
所以最明智的做法是在“向后”和“向前”方向上允许“严格”,而不是“最近”。
推荐阅读
- java - 如何解析多部分/表单数据?
- swift - 如何在 swift4 中设置 firebase 事务
- python - 谁能建议我如何获得python中最小值之前的元素?
- javascript - 如何计算jsPDF中的垂直高度?
- javascript - Js - onreadystatechange XMLHttpRequest Uncaught ReferenceError上的相同类调用方法:未定义函数
- math - Vivado 2018 上 VHDL 中的定点运算
- java - 以下程序的时间复杂度
- slack - Slack bot 仅在第一个通道中响应斜杠命令
- git - 多个依赖项目的 Git 存储库设置
- css - 如何使用 CSS 将图像添加到 div 气泡