str.starts_with¶
- ColExpr.str.starts_with(
- prefix: str,
Whether the string starts with a given prefix.
- Parameters:
prefix – The prefix to check.
Examples
>>> t = pdt.Table( ... { ... "a": [" BCD ", "-- 00", " A^^u", "-O2", ""], ... "b": ["12431", "transform", "12__*m", " ", "abbabbabba"], ... }, ... name="string table", ... ) >>> ( ... t ... >> mutate( ... j=t.a.str.starts_with("-"), ... k=t.b.str.starts_with("12"), ... ) ... >> show() ... ) Table string table, backend: PolarsImpl shape: (5, 4) ┌────────┬────────────┬───────┬───────┐ │ a ┆ b ┆ j ┆ k │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ str ┆ bool ┆ bool │ ╞════════╪════════════╪═══════╪═══════╡ │ BCD ┆ 12431 ┆ false ┆ true │ │ -- 00 ┆ transform ┆ true ┆ false │ │ A^^u ┆ 12__*m ┆ false ┆ true │ │ -O2 ┆ ┆ true ┆ false │ │ ┆ abbabbabba ┆ false ┆ false │ └────────┴────────────┴───────┴───────┘