[Python] Pandas' merge returns a column with _x appended to the name

Discussão em 'Python' iniciado por Stack, Abril 12, 2025.

  1. Stack

    Stack Membro Participativo

    I have to dataframes, df1 has columns A, B, C, D... and df2 has columns A, B, E, F...

    The keys I want to merge with are in column A. B is also (most likely) the same in both dataframes. This is a big dataset so I do not have a good overview of everything yet.

    When I do

    pd.merge(df1, df2, on='A')


    the results contains a column called B_x. Since the dataset is big and messy I haven't tried to investigate how B_x differs from B in df1 and B in df2.

    So my question is just in general: What does Pandas mean when it has appended _x to a column name in the merged dataframe?

    Continue reading...

Compartilhe esta Página