Check order of occurence, ignoring repeatation and assign a value in new coloumn
I have a processed dataset that looks like this. The S.No column follows a certain order, with some values repeating as in the sample below.
I want checkand obtain a result, where if the the rows follow the sequence as in increasing order, 1-2-3-4-5- etc (repeatation ignored), then a new coloumn needs to be assigned with a value as “X” and if it follows otherwise, that is 5-4-3-2-1, then assign “Y”.
S. No Name
1 A
1 A
1 A
1 A
2 B
2 B
3 C
3 C
3 C
4 D
4 D
5 E
5 E