I have a dataframe similar to this one:
value_1 value_2
1 2
9 6
2 5
7 2
2 5
What I need to do is to only get the rows that have a value_1 greater than 3 for example, but also get the first and last row of the dataframe. Like this:
value_1 value_2
1 2
9 6
7 2
2 5
I know that I can filter by index with iloc and by column value with loc, but how can I use them both together?