Existing Dataframe :
Id last_dt_of_payment Group payer_status
A1 22/08/2022 x 1
A2 21/05/2022 x 1
A3 01/09/2022 y 1
A4 22/01/2022 y 1
A5 26/02/2022 p 1
A6 30/09/2022 s 1
Expected Dataframe :
Id last_dt_of_payment Group payer_status
A1 22/08/2022 x 1
A2 21/05/2022 x 0
A3 01/09/2022 y 1
A4 22/01/2022 y 0
A5 26/02/2022 p 1
A6 30/09/2022 s 1
I am trying to Overwrite the payer_status basis the Group and last_dt_of_payment.
if payer_status is either x or y and
the last_dt_of_payment is done within last 3 months , the payer_status to be tagged as 1 else 0
stuck with applying logic for checking last three months payment.