In two stages:
df['fruit'] = df['fruit'].map(lambda x: x.lower())
res = df.groupby('fruit').sum()
res
And to restore your structure:
res.reset_index()
according to the comment, the lower case can be made in a more direct way as follows:
df['fruit'] = df['fruit'].str.lower()
source
share