Skip to content

Make the documentation for pandas.Series.str.replace() clearer #31225

Closed
@drkarthi

Description

@drkarthi

Problem description

The current documentation of str.replace says Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to str.replace() or re.sub()..

For the novice user this suggests that base Python's str.replace() and re.sub() provide equivalent functionality. My suggestion is to explicitly specify that this depends on the value of regex, making it clearer. Something like this:

Replace occurrences of pattern/regex in the Series/Index with some other string. Equivalent to str.replace() or re.sub() **depending on the _regex_ value**.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions