I have the following code with groupby function
order_diff = order.groupby("CD_QTY").filter( lambda x: x["BOX_ID"].nunique() > 1