0

how can i count the number of rows in which two columns of a given df have the same, particular value? I want to obtain only the number of such rows, so maybe there is a better solution than just double groupby?

I was thinking about something like that: rows = (data['col1'] == 0 and data['col2']==0).sum()

but while it works with only one condition, then when adding the second one I get an error saying The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()..

Zuzu
  • 75
  • 7

0 Answers0