polars.Series.arr.count_matches#

Series.arr.count_matches(element: IntoExpr) Series[source]#

计算由element生成的值出现的频率。

Parameters:
element

生成单个值的表达式

示例

>>> s = pl.Series("a", [[1, 2, 3], [2, 2, 2]], dtype=pl.Array(pl.Int64, 3))
>>> s.arr.count_matches(2)
shape: (2,)
Series: 'a' [u32]
[
    1
    3
]