I have the following DF
Sku Availability
0 1 out of stock
1 1 in stock
2 1 in stock
3 2 out of stock
How can I use a custom aggregate function to create the following DF:
Sku Availability
0 1 in stock
2 2 out of stock
(Basically, if a SKU is in stock, the out of stock SKUs should be dropped, I have same SKUs because each refers to a different store...)
MVCE:
d = {'Sku': ['1', '1', '1', '2'], 'Availability': ['out of stock', 'in stock', 'in stock', 'out of stock']}
df = pd.DataFrame(data=d)
# df = df.groupby('Sku').apply(lambda x: ...)