Skip to content

BUG: case argument ignored when regex is False in Series.str.replace #41602

@simonjayhawkins

Description

@simonjayhawkins
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

>>> ser = pd.Series(["A.", "a.", "Ab", "ab", np.nan], dtype="object")
>>> ser
0     A.
1     a.
2     Ab
3     ab
4    NaN
dtype: object
>>> 
>>> ser.str.replace("a", "c", case=False, regex=False)
0     A.
1     c.
2     Ab
3     cb
4    NaN
dtype: object
>>> 

Problem description

[this should explain why the current behaviour is a problem and why the expected output is a better solution]

Expected Output

>>> ser.str.replace("a", "c", case=False, regex=False)
0     c.
1     c.
2     cb
3     cb
4    NaN
dtype: object
>>> 

Output of pd.show_versions()

[paste the output of pd.show_versions() here leaving a blank line after the details tag]

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugStringsString extension data type and string data

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions