Spec-Zone.ru › Polars

polars.Expr.index_of

Expr.index_of(
    element: IntoExpr,
) → Expr

Получить индекс первого вхождения значения или None, если оно не найдено.

движок:В памятиПотоковая обработка
Параметры:
element

Значение для поиска.

Примеры

>>> df = pl.DataFrame({"a": [1, None, 17]})
>>> df.select(
...     [
...         pl.col("a").index_of(17).alias("seventeen"),
...         pl.col("a").index_of(None).alias("null"),
...         pl.col("a").index_of(55).alias("fiftyfive"),
...     ]
... )
shape: (1, 3)
┌───────────┬──────┬───────────┐
│ seventeen ┆ null ┆ fiftyfive │
│ ---       ┆ ---  ┆ ---       │
│ u32       ┆ u32  ┆ u32       │
╞═══════════╪══════╪═══════════╡
│ 2         ┆ 1    ┆ null      │
└───────────┴──────┴───────────┘

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.index_of.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API