I’ve been trying to delete the rows that have the value -9 in a certain column, but I haven’t been successful at it. Here’s what I’ve tried:
but what I get is ‘[-9] not found in axis’
I know that -9 is a value in that column because “describe” shows that the min is -9.0000. I’ve tried drop.([-9.000000]) and drop.([-9.000000], axis=0), but it didn’t work either. What could be wrong?
drop with the index of rows that match your condition:
ocupados.drop(ocupados[ocupados.MONTO_DE_INGRESO_TOTAL == -9].index, inplace=True)
Or keep rows that does not match condition:
ocupados = ocupados[ocupados.MONTO_DE_INGRESO_TOTAL != -9]