This is much easier in pandas now with drop_duplicates and the keep parameter.
import pandas as pd
df = pd.DataFrame({"A":["foo", "foo", "foo", "bar"], "B":[0,1,1,1], "C":["A","A","B","A"]})
df.drop_duplicates(subset=['A', 'C'], keep=False)
More Related Contents:
- Remove pandas rows with duplicate indices
- Remove duplicates by columns A, keeping the row with the highest value in column B
- How do I get a list of all the duplicate items using pandas in python?
- Remove duplicates from dataframe, based on two columns A,B, keeping row with max value in another column C
- Group duplicate column IDs in pandas dataframe
- How to concatenate two dataframes without duplicates?
- Remove duplicate rows from Pandas dataframe where only some columns have the same value
- drop_duplicates not working in pandas?
- How to repeat a Pandas DataFrame?
- How to “select distinct” across multiple data frame columns in pandas?
- pandas get column average/mean
- python pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working
- How can I strip the whitespace from Pandas DataFrame headers?
- Select Pandas rows based on list index
- selecting across multiple columns with python pandas?
- Problem in combining bar plot and line plot (python)
- Bar Chart: How to choose color if value is positive vs value is negative
- import pandas_datareader gives ImportError: cannot import name ‘is_list_like’
- vectorize conditional assignment in pandas dataframe
- Read csv from Google Cloud storage to pandas dataframe
- How to set the pandas dataframe data left/right alignment?
- Convert numpy type to python
- How to get/set a pandas index column title or name?
- Pandas: drop columns with all NaN’s
- How can I create the minimum size executable with pyinstaller?
- Normalize DataFrame by group
- Color a scatter plot by Column Values
- pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working
- pandas.read_csv FileNotFoundError: File b’\xe2\x80\xaa’ despite correct path
- Pandas: Selecting rows based on value counts of a particular column