Other pandas stuff Flashcards
1
Q
With a pandas DF, how do you find rows that have matching values in only certain columns?
A
- df[df.duplicated(subset=[“col1”, “col2”], keep=False)]
- In some situations it would be useful to only have one instance of the duplicate row returned, in which case you’d modify the value of the “keep” arg