Skip to content

BUG: join unexpectedly created extra column start with "key_" #61294

Open
@albb318

Description

@albb318

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

import pandas as pd

a = pd.DataFrame({0:[1,2,3]})
b = pd.DataFrame(index=[1,2,3],data={0:[4,5,6]})
a.join(b, on=0, rsuffix='_test')

Issue Description

When dataframe a and b have the same column name, a key_ column is created unexpectedly after the join operation.

key_0 0 0_test
0 1 1 4
1 2 2 5
2 3 3 6

Expected Behavior

Expecting result without the key_0 column.

Installed Versions

pandas : 2.2.3
numpy : 1.26.4

Metadata

Metadata

Assignees

Labels

BugDeprecateFunctionality to remove in pandasReshapingConcat, Merge/Join, Stack/Unstack, Explode

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions