How can I apply the results of groupby command to all rows?
Question:
Answers:
I think you are looking for transform
:
df['Sell_price'] = df.groupby(['Date', 'Product_id'])['Sell_price'].transform('max')
I think you are looking for transform
:
df['Sell_price'] = df.groupby(['Date', 'Product_id'])['Sell_price'].transform('max')