[Python] Dropping a row in a python dataframe

Discussão em 'Python' iniciado por Stack, Outubro 2, 2024.

  1. Stack

    Stack Membro Participativo

    I converted a binary string variable to 0s and 1s, but somehow I ended up with an instance of 0.5289256. I am trying to remove that one row, with several ways I have found online, but it is still there:

    OG_df_dropped = OG_df.query("type != 0.528926 ")
    unique_values = OG_df_dropped ['type'].unique()
    print(unique_values)
    [0. 0.52892562 1.

    ]


    I have also tried this:

    i = OG_df[((OG_df.type == 0.528926 ) )].index
    print(i)
    OG_df.drop(i)


    Again, same results

    What am I missing or doing wrong?

    Continue reading...

Compartilhe esta Página