The title may not be super clear. What I want to do is the following.
I have the following dataframe:
df = pd.DataFrame(
{
"id": ["1", "2", "3", "1", "4", "5", "2", "6", "3", "1", "4"],
"value": ["A", "A", "B", "B", "B", "C", "C", "A", "A", "D", "A"],
},
index=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
)
Using this data frame I'd like to create a new data frame with the rows those appear for the first time the with respect to the column "id". So, it would mean the rows with the indices: 0,1,2,4,5 and 7.
I hope the problem is expressed clear enough. Thanks.