I need to create a dataframe such that:
- df.Condition == A , df.Output = True
- Next three rows after df.Output = True (even when Condition=="A", df.Output = None
Original df
Condition A A B A B A B
Desired output:
Condition Output A True B None A None B None A True B None A None B None
Can this be achieved through a vectorised method without resorting to use loop? Thanks!
Источник: https://stackoverflow.com/questions/781 ... erval-cond