Task is to generate a column `avg` where `avg` = `1st value of 'pts' group by 'id'` / `max value of 'x' group by 'id'`. NB: If max of x=0, then division operation will be ignored and `avg` remains `NaN`.

Sample df:

```
   id  pts  x
0   1   75  0
1   1   75  1
2   1   75  2
3   2   48  0
4   2   48  0
5   3   53  0
6   3   53  2
7   3   53  3
8   3   53  3
9   4   6   1

```

Expected df:

```
   id  pts  x   avg
0   1   75  0   37.50
1   1   75  1   37.50
2   1   75  2   37.50
3   2   48  0   NaN
4   2   48  0   NaN
5   3   53  0   17.66
6   3   53  2   17.66
7   3   53  3   17.66
8   3   53  3   17.66
9   4   6   1   6.00

```

I tried:

```
df['avg'] = df['id'].map(df.groupby('id').apply(lambda x: x['pts'].iloc[0] / x['x'].max()))

```