Deleting rows in SQL is performed using DELETE FROM
. Translated to pandas, apply the .loc method to select a subset of a DataFrame without the deleted records.
Deleting rows from a DataFrame
In SQL:
DELETE FROM
table
WHERE
column_1 = 100;
To achieve the same for a pandas DataFrame, we select everything except what we want to delete.
In pandas:
table.loc[table["column_1"] != 100]