Is there a better way of doing the below manipulation?
df = pd.DataFrame(data={
"id": ['a', 'a', 'a', 'b', 'b', 'b', 'b'],
"date": ["2020-01-01", "2020-01-11", "2020-01-10", "2020-01-06", "2020-02-01", "2020-02-22", "2020-02-20"],
"type": ["start", "start", "closing", "start", "start", "closing", "closing"],
})
for id in df['id'].unique():
closing_date = df.loc[(df['id'] == id) & (df['type'] == 'closing'), 'date'].min()
df.loc[(df['id'] == id) & (df['date'] > closing_date), 'date'] = closing_date