np.array([(df.DATA.rolling(4).max().shift(-i) == df.DATA) for i in range(4)]
    ).T.sum(axis=1)
How to calculate the values of a pandas DataFrame column depending on the results of a rolling function from another column