Monthly average spent mode

Screen Link:

My Code:
reside_mode = reside.groupby('CountryLive').apply(lambda x: x.mode([0]))
reside_mode['spent_monthly'][['Canada', 'India', 'United Kingdom', 'United States of America']]

What I expected to happen:

First mode to print.
What actually happened:

TypeError: unhashable type: 'list'

How would I pick the first mode returned in the mode series?

FindBestMarketstoAdvertise-Copy2.ipynb (118.5 KB)

Hi @vroomvroom,

You need the first mode for every column for every country, in a form of a dataframe, right?
Then you need this code:

import scipy
reside_mode = reside.groupby(['CountryLive']).agg(lambda x: scipy.stats.mode(x)[0])