顶部函数
以下 Python 函数接受一个整数参数 n,并生成如表中所述的前 n 个元素的结果序列:
top_max
top_max(n)
返回对象序列中的前 n 个最大值。
top_min
top_min(n)
返回对象序列中的前 n 个最小值。
top_pos_max
top_pos_max(n)
返回对象序列中前 n 个最大值的位置。
top_pos_min
top_pos_min(n)
返回对象序列中前 n 个最小值的位置。
示例
以下是一个示例代码片段,展示了这些函数中的一个:
cursor = con.cursor("Quote", "by_sym")
for quote in cursor:
...
hi20Iterator = quote.close.top_max( 20 )
...