0
votes

I have a Dataframe which looks like this

Col A   Col B   Col C  Col D
X       YY      0      1
X       YY      2      5
X       YC      3      7
X       YC      1      9

................. What i want to do is, I want to iterate through each unique value of Col B and select each, do some calculation and then select the next unique value and so on.

The algorithm looks like this:

For each unique value of Col B:
     Do some calculation


return to another unique value of Col B. 

I have tried using for loop. But can not complete it. I have datetime data in Col A.