From 513cfcffffe6f5bbf859b5db4034532bffd04f3c Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Mon, 29 Jan 2024 13:37:33 +0000 Subject: [PATCH] show both in README --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7fe7c87..c420ce3 100644 --- a/README.md +++ b/README.md @@ -72,8 +72,6 @@ def pig_latinnify(expr: IntoExpr, capitalize: bool = False) -> pl.Expr: kwargs={"capitalize": capitalize}, ) ``` -and/or registered as a [Expression Extension](https://docs.pola.rs/py-polars/html/reference/api/polars.api.register_expr_namespace.html#polars.api.register_expr_namespace). - Compile/ship and then it is ready to use: ```python @@ -89,6 +87,12 @@ out = df.with_columns( pig_latin = language.pig_latinnify("names") ) ``` +Alternatively, you can [register a custom namespace](https://docs.pola.rs/py-polars/html/reference/api/polars.api.register_expr_namespace.html#polars.api.register_expr_namespace), which enables you to write: +```python +out = df.with_columns( + pig_latin = pl.col("names").language.pig_latinnify() +) +``` See the full example in [example/derive_expression]: https://github.com/pola-rs/pyo3-polars/tree/main/example/derive_expression