Replicating output of excel COUNTIFs in pandas

Viewed 39

enter image description here

I have dataset with the following column - Source, Sink, StartDate, EndDate, Class, MW, ClearingPrice. I am trying to create a column (Path_Repeat) that takes value 1 if the a particular Source-Sink combinations reverse exists in the dataset for the same StartDate and EndDate.

I was able to do this in excel by using a =COUNTIFS(A:A,B2,B:B,A2,C:C,C2,D:D,D2,E:E,E2). I wondering if there is a way of doing this in pandas that is faster than excel.

0 Answers
Related