I have the data series including these labels for my dataset:
s=['A','A','A','A','B','B','B','B','C','C','C','C','D','D','D','D','D']
I would like to know how can I get the index of first element B
and the last element of C
.
Index of the first element B
s.index('B')
Index of the last element C
len(s) - s[::-1].index('C') - 1