fruits = df['fruitname'].value_counts().index[(df['fruitname'].value_counts
    () % 2).astype(bool)]
idx = []
for fruit in fruits:
    idx.append(df[df['fruitname'] == fruit].last_valid_index())
df.drop(idx)
python pandas dataframe : removing selected rows