df['time_separation'] = np.minimum(df['DateTime'].diff().values, -df[
    'DateTime'].diff(-1).values)
df['is_isolated'] = df['time_separation'] > '00:00:00.08'
df['group'] = (df['is_isolated'] != df['is_isolated'].shift()).cumsum()
df.loc[df['is_isolated'], 'group'] = -1
How to efficiently compare rows in a pandas DataFrame?