Skip to content

BUG: Series.replace(dict-like, dict-like) raises uninformative AttributeError #59452

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

Closed
3 tasks done
mroeschke opened this issue Aug 8, 2024 · 1 comment · Fixed by #59552
Closed
3 tasks done

BUG: Series.replace(dict-like, dict-like) raises uninformative AttributeError #59452

mroeschke opened this issue Aug 8, 2024 · 1 comment · Fixed by #59552
Assignees
Labels
Enhancement Error Reporting Incorrect or improved errors from pandas replace replace method

Comments

@mroeschke
Copy link
Member

mroeschke commented Aug 8, 2024

Pandas version checks

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

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

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

In [2]: pd.Series([1, 2]).replace(pd.Series([1]), pd.Series([2]))
AttributeError: 'Series' object has no attribute '_replace_columnwise'

Issue Description

It appears .replace(dict-like, dict-like) is only valid if the original object is a DataFrame so this should probably raise a ValueError instead of raising an AttributeError

Expected Behavior

Raise a ValueError

Installed Versions

Replace this line with the output of pd.show_versions()

@mroeschke mroeschke added Enhancement Error Reporting Incorrect or improved errors from pandas replace replace method labels Aug 8, 2024
@mroeschke mroeschke changed the title BUG: Series.reaplce(dict-like, dict-like) raises uninformative AttributeError BUG: Series.replace(dict-like, dict-like) raises uninformative AttributeError Aug 8, 2024
@fbourgey
Copy link
Contributor

fbourgey commented Aug 9, 2024

take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Error Reporting Incorrect or improved errors from pandas replace replace method
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants