maxframe.dataframe.Series.list.__getitem__#
- Series.list.__getitem__(query_index)#
通过 Series 中每个列表的索引获取值。如果索引不在列表中,则抛出 IndexError。
- 参数:
query_index (Any) -- 要检查的索引,必须是整数。
- 返回:
一个包含列表值数据类型的 Series。如果列表为 None,则返回
None。- 返回类型:
- 抛出:
KeyError -- 如果索引不在某个列表中。
参见
Series.list.get通过 Series 中每个列表的索引获取值。
示例
创建一个包含列表类型数据的 Series。
>>> import maxframe.dataframe as md >>> import pyarrow as pa >>> from maxframe.lib.dtypes_extension import list_ >>> s = md.Series( ... data=[[1, 2, 3], [4, 5, 6], None], ... index=[1, 2, 3], ... dtype=list_(pa.int64()), ... ) >>> s.execute() 1 [1, 2, 3] 2 [4, 5, 6] 3 <NA> dtype: list<int64>[pyarrow]
>>> s.list.get(0).execute() 1 1 2 4 3 <NA> dtype: int64[pyarrow]