pyarrow.compute.RankOptions#

class pyarrow.compute.RankOptions(sort_keys='ascending', *, null_placement='at_end', tiebreaker='first')#

基类: _RankOptions

rank 函数的选项。

参数:
sort_keyssequence of (name, order) tuples or str, default “ascending”

用于对输入进行排序的字段/列键名,以及每个字段/列的排序顺序。order 的可选值为 “ascending”(升序)和 “descending”(降序)。字段名可以是字符串形式的列名或表达式。如果输入类似于数组,也可以直接传入 “ascending” 或 “descending” 字符串。

null_placementstr, 默认 “at_end”

输入中 null 值的排序位置。可选值为 “at_start”(开头)和 “at_end”(结尾)。

tiebreakerstr, default “first”

配置如何处理相同值之间的平局(tie)。可选值为:

  • “min”:平局项获得排序顺序中可能的最小排名。

  • “max”:平局项获得排序顺序中可能的最大排名。

  • “first”:根据平局项在输入中出现的先后顺序进行分配排名。

    这确保了排名是输入的一个稳定排列。

  • “dense”:排名跨越一个密集的 [1, M] 区间,其中 M 是

    输入中不同值的数量。

__init__(self, sort_keys='ascending', *, null_placement='at_end', tiebreaker='first')#

方法

__init__(self[, sort_keys, null_placement, ...])

deserialize(buf)

反序列化函数的选项。

serialize(self)

static deserialize(buf)#

反序列化函数的选项。

参数:
bufBuffer

包含要反序列化数据的缓冲区。

serialize(self)#