str.ends_with¶
- ColExpr.str.ends_with(
- suffix: str,
Whether the string ends with a given suffix.
- Parameters:
suffix – The suffix 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.ends_with(""), ... k=t.b.str.ends_with("m"), ... l=t.a.str.ends_with("^u"), ... ) ... >> show() ... ) Table string table, backend: PolarsImpl shape: (5, 5) ┌────────┬────────────┬──────┬───────┬───────┐ │ a ┆ b ┆ j ┆ k ┆ l │ │ --- ┆ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ str ┆ bool ┆ bool ┆ bool │ ╞════════╪════════════╪══════╪═══════╪═══════╡ │ BCD ┆ 12431 ┆ true ┆ false ┆ false │ │ -- 00 ┆ transform ┆ true ┆ true ┆ false │ │ A^^u ┆ 12__*m ┆ true ┆ true ┆ true │ │ -O2 ┆ ┆ true ┆ false ┆ false │ │ ┆ abbabbabba ┆ true ┆ false ┆ false │ └────────┴────────────┴──────┴───────┴───────┘