Skip to content

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

Closed
@mroeschke

Description

@mroeschke

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()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions