Other pandas stuff Flashcards Preview

11637 Foundations of Computational Data Science > Other pandas stuff > Flashcards

Flashcards in Other pandas stuff Deck (1)
Loading flashcards...

With a pandas DF, how do you find rows that have matching values in only certain columns? 

  • 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