pyarrow.MapScalar#
- class pyarrow.MapScalar#
基类:
ListScalar,Mapping用于映射(map)标量的具体类。
- __init__(*args, **kwargs)#
方法
__init__(*args, **kwargs)as_py(self, *[, maps_as_pydicts])根据 'maps_as_pydicts' 将此值返回为 Python 列表或字典。
cast(self[, target_type, safe, options, ...])将标量值转换为另一种数据类型。
count(value)equals(self, Scalar other)get(k[,d])index(value, [start, [stop]])如果值不存在,则引发 ValueError。
items()keys(self)返回映射的键作为列表。
validate(self, *[, full])执行验证检查。
属性
- as_py(self, *, maps_as_pydicts=None)#
根据 ‘maps_as_pydicts’ 将此值返回为 Python 列表或字典。
- 参数:
- maps_as_pydicts
str, 可选, 默认 None 有效值为 None、‘lossy’ 或 ‘strict’。默认行为 (None) 是将 Arrow Map 数组转换为与 Arrow Map 顺序相同的原生 Python 关联列表(元组列表),如 [(key1, value1), (key2, value2), …]。
如果为 ‘lossy’ 或 ‘strict’,则将 Arrow Map 数组转换为原生 Python 字典。
如果为 ‘lossy’,则每当检测到重复键时,都会打印警告。重复键的最后看到的值将出现在 Python 字典中。如果为 ‘strict’,则会在检测到时引发异常。
- maps_as_pydicts
- cast(self, target_type=None, safe=None, options=None, memory_pool=None)#
将标量值转换为另一种数据类型。
用法请参见
pyarrow.compute.cast()。
- count(value) integer -- 返回 value 出现的次数#
- equals(self, Scalar other)#
- 参数:
- other
pyarrow.Scalar
- other
- 返回:
- get(k[, d]) 如果 k 在 D 中,则返回 D[k],否则返回 d。d 默认为 None。#
- index(value[, start[, stop]]) integer -- 返回 value 的第一个索引。#
如果值不存在,则引发 ValueError。
支持 start 和 stop 参数是可选的,但建议使用。
- is_valid#
包含一个有效(非空)值。
- items() 一个提供 D 项视图的类似集合的对象#
- keys(self)#
返回映射的键作为列表。
- type#
Scalar 对象的数据类型。
- validate(self, *, full=False)#
执行验证检查。如果验证失败,则会引发异常。
默认情况下,仅运行低成本的验证检查。传递 full=True 进行彻底的验证检查(可能为 O(n))。
- values#