I have this script:
sectors = df.groupby(['company_sector']).mean()['investment_in_millions']
I wanted to keep the same groupy() but having a result in "investment_in_millions" column filtered as mean > 10 or another value.
If apply this:
sectors = df.groupby(['company_sector']).mean()['investment_in_millions']>10
I keep the groupby() but it returns a boolean into the investment column.
If I use:
filtered = df[df['investment_in_millions']>10]
I get the filtered values mean>10 but the groupby() is not there anymore and I get all the other columns in the excel.
How can I get the groupby() together with the mean>10 without getting a boolean result?