I have a data frame like this:
df
col1 col2 col3
1 A B
1 D R
2 R P
2 D F
3 T G
1 R S
3 R S
I want to get the data frame with first 3 unique value of col1. If some col1 value comes later in the df, it will ignore.
The final data frame should look like:
df
col1 col2 col3
1 A B
1 D R
2 R P
2 D F
3 T G
How to do it most efficient way in pandas ?