polars.Expr.index_of
-
Получить индекс первого вхождения значения или
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 │ └───────────┴──────┴───────────┘
Expr.index_of(
element: IntoExpr,
) → Expr
© 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