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): Add documentation on replacement strings to str.replace and str.replace_all #13382

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

Wainberg
Copy link
Contributor

@Wainberg Wainberg commented Jan 2, 2024

Closes #13366.

@github-actions github-actions bot added documentation Improvements or additions to documentation python Related to Python Polars labels Jan 2, 2024
@Wainberg
Copy link
Contributor Author

Wainberg commented Jan 4, 2024

@stinodego good to merge?

Copy link
Member

@stinodego stinodego left a 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 Show resolved Hide resolved
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"))
Copy link
Member

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.

@stinodego
Copy link
Member

Just came to mind: you can probably condense the examples a lot by using a single with_columns with multiple of the expressions you're trying to showcase.

@Wainberg
Copy link
Contributor Author

@stinodego should be good to merge now!

@stinodego stinodego changed the title docs(python): add documentation on replacement strings to str.replace and str.replace_all docs(python): Add documentation on replacement strings to str.replace and str.replace_all Jan 14, 2024
@Wainberg
Copy link
Contributor Author

@stinodego here's another documentation one that I think is ready to merge

Copy link
Member

@stinodego stinodego left a 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.

@Wainberg
Copy link
Contributor Author

I took out the code examples from the warnings section. I will follow up again in a week or two.

@stinodego stinodego merged commit 9e87515 into pola-rs:main Jan 30, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation python Related to Python Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add documentation on replacement strings to str.replace and str.replace_all
2 participants