[Python] I am trying to delete some repeat columns from my dataframe using drop method by...

Discussão em 'Python' iniciado por Stack, Maio 4, 2025.

  1. Stack

    Stack Membro Participativo

    I have this dataframe.

    I want to keep the first 'ENZYME' column and delete the other instances. I am using:

    df_CL_HHA_2=df_CL_HHA.drop(df_CL_HHA.columns[[2,4,6]],axis=1)


    But this leads to this result.

    I am not sure why the first column is getting deleted despite setting 2,4,6 as my column indexes for dropping. Any help is much appreciated.

    Continue reading...

Compartilhe esta Página