gpt4 book ai didi

KDB+/Q : How does one select all items (keys+values) of a dictionary where the respective value conforms to a condition?

转载 作者:行者123 更新时间:2023-12-03 23:26:54 25 4
gpt4 key购买 nike

如何根据其中的值过滤字典中的项目。例如,给定以下字典:

990.5| 0
900.5| 0
600.5| 300
600 | -300

如何过滤掉其中值 = 0 的所有实例。之后的结果是:

600.5| 300
600 | -300

谢谢

最佳答案

这是一种方法。

q)d: 990.5 900.5 600.5 600 ! 0 0 300 -300
q)k ! d k: where d <> 0
600.5| 300
600 | -300

关于KDB+/Q : How does one select all items (keys+values) of a dictionary where the respective value conforms to a condition?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62635692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com