M. Schuurman
M. Schuurman

Reputation: 31

write unique values column pandas

So I have a dataframe with different data:

Ordernumber Name customerID
Abel 1939184849
Rose 1029480129
Rob 1283949203

As you can see the name and customerID are already filled in. Now I need to generate unique ordernumbers, please keep in mind that the actual database has around 20,000 rows, so the ordernumber has to be unique.

Upvotes: 1

Views: 28

Answers (1)

sophocles
sophocles

Reputation: 13821

Can it be only numbers? i.e. ranging from 0 to the total length of your dataframe?

df['Ordernumber'] = [n for n in range(0,len(df),1)]

Upvotes: 1

Related Questions