number every first unique piece in each group
In each group, each 1st unique item should be given a different number in new column ‘num’.
How do I get the unique combinations of values that exist in all groupings
I want to know what are the existing combinations of uom values that products have.
Given
df = pd.DataFrame([{'prod_id':3,'uom':'PK'},{'prod_id':3,'uom':'PQT'},{'prod_id':4,'uom':'PK'},{'prod_id':5,'uom':'PQT'},{'prod_id':5,'uom':'PK'},{'prod_id':6,'uom':'SET'},{'prod_id':6,'uom':'ENS'},{'prod_id':7,'uom':'PK'},{'prod_id':7,'uom':'ENS'}])