[Python] Pandas: can't drop columns: ValueError: labels [<colName>] not contained in axis

Discussão em 'Python' iniciado por Stack, Março 23, 2025.

  1. Stack

    Stack Membro Participativo

    I have a df created from a simple CSV. When I try to reference columns by their names, to merge into a new df or to drop, I am getting a

    ValueError: labels [<colName>] not contained in axis


    I understand that to drop a column you must use

    axis=1


    It's as if somehow the df is confused that my columns are the columns, even though they are the top row and bolded when viewed in iPython.

    Continue reading...

Compartilhe esta Página