I want to create a SKU number depending on the article number like the following:
article_nr SKUid
0 101 1
1 101 2
2 101 3
3 152 1
4 152 2
5 160 1
6 170 1
Can somebody help me with my problem?
My idea was to create something like:
for i in range(len(df01)):
while True:
if df01['article_nr'][i+1] == df01['article_nr'][i]:
df01['SKUid'][i+1] = range(1, len(df01) + 1)
else:
df01['SKUid'][i] = 1
is there a smart and efficient way?
Thank you all in advance!