Counting Transaction after initial discounted transaction

Viewed 30

I'm stuck! The goal is to count the number of customer transactions after initially being drawn in by a discount to determine "X% of customers never return when the first visit is discounted"

This was the best I could do:

postpurchase = (df_coup['DISC_BI'] == 1 & df_coup['LOGDATE'] > df_coup['LOGDATE1'])

I gotta think there's a way to loop this or something.

Data Frame:

data frame

1 Answers

Try using sum:

postpurchase = ((df_coup['DISC_BI'] == 1) & (df_coup['LOGDATE'] > df_coup['LOGDATE1'])).sum()
Related