df['time_diff'] = df.groupby('User')['Time'].diff()
df['Col1_0'] = df['Col1'].apply(lambda x: x[0])
df['Col1_0_prev'] = df.groupby('User')['Col1_0'].shift()
Fastest way to compare row and previous row in pandas dataframe with millions of rows