Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas groupby multiple columns

#formatting
candidates_salary_by_month =  candidates_df.groupby('month').agg(num_cand_month = 
                                                                ('num_candidates', 'sum'), 
                                                                avg_sal = ('salary', 'mean')).style.format('{:.0f}')

print(candidates_salary_by_month)
Source by www.easytweaks.com #
 
PREVIOUS NEXT
Tagged: #pandas #groupby #multiple #columns
ADD COMMENT
Topic
Name
4+4 =