I can't figure out how (DataFrame - Groupby) works.

Specifically, given the following dataframe:

```
df = pd.DataFrame([['usera',1,100],['usera',5,130],['userc',1,100],['userd',5,100]])
df.columns = ['id','date','sum']

    id  date    sum
0   usera   1   100
1   usera   5   130
2   userc   1   100
3   userd   5   100

```

Passing the below code returns:

```
df['shift'] = df['date']-df.groupby(['id'])['date'].shift(1)

    id  date    sum shift
0   usera   1   100 
1   usera   5   130 4.0
2   userc   1   100 
3   userd   5   100 

```

How did Python know that I meant for it to match by id column?
It doesn't even appear in `df['date']`