0

I have a Pandas dataframe where for each second (x) point I have a defined value (y). Looking like this:

    Col_x  Col_y 
0     1    34 
1     5    34 
2     7    34 
3     8    18 
4     9    18 
5     11   99 
6     34   99 
7     45   99 

I want it to look like this So I only get the first value whenever it changes:

    Col_x  Col_y 
0     1    34 
3     8    18 
5     11   99 

The only option I am thinking of involves loops but I do not want to use them because of efficiency. Thanks!

0 Answers0