Skip to content

Commit

Permalink
show both in README
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Jan 29, 2024
1 parent 8c6d74f commit 513cfcf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 513cfcf

Please sign in to comment.