[Python] pandas.errors.MergeError Not allowed to merge between different levels

Discussão em 'Python' iniciado por Stack, Julho 24, 2025.

  1. Stack

    Stack Membro Participativo

    I'm having trouble joining two datasets

    data = races_df.join(runs_df, on='race_id', how='right')
    X = data[data.columns[:-14]]
    ss = preprocessing.StandardScaler()
    X = pd.DataFrame(ss.fit_transform(X),columns = X.columns)
    y_won = data[data.columns[-14:]].applymap(lambda x: 1.0 if 0.5 < x < 1.5 else 0.0)

    print(X.shape)
    print(y_won.shape)


    when i run the code i get error message

    pandas.errors.MergeError: Not allowed to merge between different levels.
    (1 levels on the left, 2 on the right)


    Does anyone know the correct code that wont produce this error thx

    Continue reading...

Compartilhe esta Página