0

I am trying to drop redundant rows from dataframe by checking if the value exists in specific list by using this code:

loadedAndClicked = bouncyDF[bouncyDF['source_event_id'] in clickedQueries]

and the error message is: ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). can anyone tell me why?

Update: .isin() works!

loadedAndClicked = bouncyDF[bouncyDF['source_event_id'].isin(clickedQueries)]
  • See the `.isin` method on the selected answer from this post. Does this answer your question? https://stackoverflow.com/questions/17071871/how-do-i-select-rows-from-a-dataframe-based-on-column-values/17071908#17071908 – Cameron Riddell Jun 17 '21 at 22:28

0 Answers0