this is an example of a bigger dataframe:
column1
0 a
1 b
2 x
3 c
4 b
5 x
6 d
7 x
8 e
9 e
In this dataframe, I would like to select every row that has 'x' on it and also the exaclty rows above each of these ones. And then I want to create another dataframe with these new rows.
The final dataframe should be like this:
column1
1 b
2 x
4 b
5 x
6 d
7 x
Anyone could help me?
Thanks