Hi all,
I merged various datasets together. The output is the following dataframe:
product_town = pd.merge(left=product_train, right=town_train, how='outer', on='Producto_ID')
product_town.sort_values(by='count_name', ascending=False).head(50)
I grouped the dataframe using the following code and got:
product_town.groupby(['name','count_name'])[['name','count_name','State', 'location']].head(50).dropna().sort_values(by='count_name', ascending=False)
My desired output is the unique values, for example
Pan Blanco 39.0 Mexico, D.F
Tuinky Fresas 2.0 México, D.F
Pan Blanco 39.0 Aguascalientes
I believe I am missing an aggregate function but I can’t get it to work. Please help.
Thanks,