df = pd.DataFrame([3, 2, 3, 2, 1], index=pd.DatetimeIndex(start=
    '2014-05-01 01:00:00', periods=5, freq='S'), columns=['output'])
Python pandas calculate time until value in a column is greater than it is in current period