Oct-18-2018, 09:33 PM
(Oct-18-2018, 08:25 PM)pradeepkumarbe Wrote: Yes I agree UUID will solve my problem, but my output should be like below here how can we avoid Iteration?
Territory NoOfCustomers UniqueId D00060 10 0001ABSDFG79 D00060 10 0001ABKJKJ90 D00060 10 0001ABVVVV92 D00060 10 0001ABJHJJ93 D00060 10 0001ABCCVV95
You don't avoid iteration - you don't write it explicitly.
pandas
does it for you under the hood.uuid.uuid<n>()
yields one value on each call - yet you can assign its output to a DataFrame
column. You can use any function on the right side of the assignment - or you may have a list/tuple, in the latter case the only limitation being that the length of the list macthes number of rows in your DataFrame
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.