df = pd.DataFrame([['2022-02-10 13:56:26+00:00', 1.0],
['2022-02-10 13:54:26+00:00', 4.0],
['2022-02-10 13:52:26+00:00', 6.0],
['2022-02-10 13:50:26+00:00', 8.0],
['2022-02-10 12:20:04+00:00', 1.0],
['2022-02-10 12:18:04+00:00', 5.0]], columns=['datetime', 'value'])
df['datetime'] = pd.to_datetime(df['datetime'])
df['group'] = np.where((df['datetime'].shift(1) - df['datetime']).dt.seconds > 1200, 1, 0).cumsum()
df = df.groupby('group').agg({'datetime': 'max', 'value': 'sum'})
print(df.head(20))