fetching indexes of 1st occurance of elements in a series in a dataframe columns

Viewed 33

Consider a python dataframe

A      B         C  
1      random    imp1  
2      random    imp2  
5      random    imp3   
1      yes       ---  
2      yes       ---   
3      no        ---   
4      no        ---  
5      yes       ---  

Whenever column B has a value yes, I want to fetch values of A. And eventually for those values of A, I want C when those values occurred 1st in A. So in this case, I finally want imp1, imp2 and imp3.

Is there an elegant way of doing this.

3 Answers
Related