pandas eliminar filas de un dataframe con una condicion 1

pandas eliminar filas de un dataframe con una condicion

df = df.drop(df[df['C']==True].index)

Here is what the above code is Doing:
1. Create a new column called ‘C’ that is True when the ‘B’ column is greater than 0.5 and False otherwise.
2. Create a new dataframe called df1 that is a copy of the original dataframe.
3. Drop all rows in df1 where the value in the ‘C’ column is True.
4. Drop all rows in the original dataframe where the value in the ‘C’ column is True.

Similar Posts