-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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): Add documentation on replacement strings to str.replace
and str.replace_all
#13382
Conversation
@stinodego good to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, there's a lot of useful info here!
Honestly, I feel like there are a few too many code examples now. It's good to know you can escape $
but it doesn't really need its own code example - it can just be a note. Could you try to condense this a little bit, keep the info that really needs to be in the docs, and point to the regex crate docs for the rest?
py-polars/polars/expr/string.py
Outdated
to the second capture group, and so on: | ||
|
||
>>> df = pl.DataFrame({"word": ["hat", "hut"]}) | ||
>>> df.select(pl.col.word.str.replace("h(.)t", "b${1}d")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you use with_columns
instead, users can easily see the before/after.
Just came to mind: you can probably condense the examples a lot by using a single |
@stinodego should be good to merge now! |
str.replace
and str.replace_all
@stinodego here's another documentation one that I think is ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't appreciate being pinged all the time. As I explained, it's all a matter of prioritization.
There are still code examples outside of the Examples sections, so this is not ready yet.
I took out the code examples from the warnings section. I will follow up again in a week or two. |
43e5a45
to
24385e5
Compare
Co-authored-by: @Wainberg
24385e5
to
12d3b6c
Compare
Closes #13366.