torcharrow.functional.firstx¶
- torcharrow.functional.firstx(col: ListColumn, num_to_copy: int)¶
返回输入列头部的前 x 个值
- 参数:
col (包含值列表的列) –
num_to_copy (从列表头部返回的元素数量) –
示例
>>> import torcharrow as ta >>> from torcharrow import functional >>> a = ta.column([[1, 2, 3],[5,8],[13]]) >>> functional.firstx(a, 3) 0 [1, 2, 3] 1 [5, 8] 2 [13] dtype: List(Int64(nullable=True), nullable=True), length: 3, null_count: 0