df['session_break'] = (df['start_timestamp'] - df.groupby('user_id')[
    'end_timestamp'].shift(1) >= 15).astype('int')
df
df['session_label'] = df.groupby('user_id')['session_break'].cumsum()
df
Is there another way to add a column to a groupby when using pandas?