This is just a quick question with a yes or no answer. I couldn't find an answer for on google or here (difficult to google).
I just want to know if I am doing this the correct way.
I am trying to select data matching certain conditions. Here is a snipped from my code.
c1 = (data['recency']<=3) # seen in the last 3 months
c2 = (data['transactions_per_month']>=1) # buys a ticket once a month
c3 = (data['av_spend_per_month']>=30) # spends at least €30 per month
c4 = (data['Driver']==1) # is a driver
# slice the df
data[c1 & (c2 | c3) & c4]
Is this part correct? (c2 | c3)
Can I add a |
condition in the middle of my &
conditions?
If it is wrong, what is the correct way to do it?