Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created March 16, 2020 18:49
Show Gist options
  • Save aniruddha27/34cbd26781652bb02f5c0a3f5ac3d734 to your computer and use it in GitHub Desktop.
Save aniruddha27/34cbd26781652bb02f5c0a3f5ac3d734 to your computer and use it in GitHub Desktop.
#different aggregate functions
table = pd.pivot_table(df,index=['Sex','Pclass'],aggfunc={'Age':np.mean,'Survived':np.sum})
table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment