Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(python): Note that only one name operation is allowed per expression #14075

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions py-polars/polars/expr/name.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ def keep(self) -> Expr:

Notes
-----
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain.
expression in a chain. Only one name operation per expression will work.
Consider using `.name.map` for advanced renaming.

See Also
--------
Expand Down Expand Up @@ -69,6 +72,14 @@ def map(self, function: Callable[[str], str]) -> Expr:
"""
Rename the output of an expression by mapping a function over the root name.

Notes
-----
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain. Only one name operation per expression will work.


Parameters
----------
function
Expand Down Expand Up @@ -115,12 +126,14 @@ def prefix(self, prefix: str) -> Expr:
prefix
Prefix to add to the root column name.


Notes
-----
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain.
expression in a chain. Only one name operation per expression will work.
Consider using `.name.map` for advanced renaming.

See Also
--------
Expand Down Expand Up @@ -162,7 +175,8 @@ def suffix(self, suffix: str) -> Expr:
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain.
expression in a chain. Only one name operation per expression will work.
Consider using `.name.map` for advanced renaming.

See Also
--------
Expand Down Expand Up @@ -196,8 +210,11 @@ def to_lowercase(self) -> Expr:

Notes
-----
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain.
expression in a chain. Only one name operation per expression will work.
Consider using `.name.map` for advanced renaming.

See Also
--------
Expand Down Expand Up @@ -233,8 +250,11 @@ def to_uppercase(self) -> Expr:

Notes
-----
This will undo any previous renaming operations on the expression.

Due to implementation constraints, this method can only be called as the last
expression in a chain.
expression in a chain. Only one name operation per expression will work.
Consider using `.name.map` for advanced renaming.

See Also
--------
Expand Down
Loading