Pandas - Avoid boolean result when using groupby()
First filter your results:
filtered_df = df[df['investment_in_millions']&gt;10]

And then group it by company_sector
import numpy as np 

sectors = filtered_df.groupby(['company_sector']).agg({&quot;investment_in_millions&quot;:np.mean})

You can do it in one line:
sectors = df[df['investment_in_millions']&gt;10].groupby(['company_sector']).agg({&quot;investment_in_millions&quot;:np.mean})