def f1(s):
    return max(s, key=len)
data = pd.DataFrame([{'id': 'GB', 'name': '"United Kingdom"'}, {'id': 'GB',
    'name': 'England'}, {'id': 'US', 'name': '"United States"'}, {'id':
    'US', 'name': 'America'}])
data.groupby('id').agg({'name': f1})
How to reduce a data with the longest string under pandas framework?