# Pandas: Group by Single Column Entries [closed]

So have this table above. I'm trying to aggregate the occupations such that the table results in:

I've tried using df.groupby(['Occupation']) but I get an error. All I know is that my final step would be to set the index to "Occupation". But I still don't know how to group via entries in the single Occupation column here.

Also, what type of table would the final table be name/called?

I know it's not called a mutiindex table because there is only one index that the results are being grouped by.

• It seems you're not applying any function to aggregate each group. Apr 24 at 19:42

import pandas as pd