I wrote this code:
tmp_ml['mode_dur_secs_lb'] = tmp_ml.groupby(['id', 'c_num']).apply( lambda x: x['mode_duration_secs']*0.9)table:
| id | c_num | mode_duration_secs |
|---|---|---|
| a1 | 116 | 20 |
| a1 | 279 | 3 |
| a2 | 9 | 19 |
| a3 | 16 | 16 |
| a3 | 17 | 19 |
TypeError: incompatible index of inserted column with frame index