xinrong-databricks edited a comment on pull request #35747:
URL: https://github.com/apache/spark/pull/35747#issuecomment-1064637020
The result for the example you give should be
```py
>>> psser = ps.Series(['bat', 'foo', 'bait', 'abc', 'bar', 'zoo'])
>>> psser.replace(to_replace=r'^ba.$', value='new', regex=True)
0 new
1 foo
2 bait # bait is not replaced since it doesn't pattern match `'^ba.$'`
3 abc
4 new
5 zoo
dtype: object
```
The existing example in the PR `psser.replace('ba', 'xx', regex=True)` is to
show even `ba` partially match `bait`, the replacement `xx` is applied to the
whole string `bait`, i.e. `bait` is replaced to `xx`.
I will rephrase the docstring to make it clear. Let me know if you still
have questions.
CC @bjornjorgensen
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]