pandas.Series.list.len#

Series.list.len()[源代码]#

返回 Series 中每个列表的长度。

返回:
pandas.Series

每个列表的长度。

参见

str.len

Python built-in function returning the length of an object.

Series.size

Returns the length of the Series.

StringMethods.len

Compute the length of each element in the Series/Index.

例子

>>> import pyarrow as pa
>>> s = pd.Series(
...     [
...         [1, 2, 3],
...         [3],
...     ],
...     dtype=pd.ArrowDtype(pa.list_(pa.int64())),
... )
>>> s.list.len()
0    3
1    1
dtype: int32[pyarrow]