Created
February 1, 2017 20:41
-
-
Save ankailou/a70853ead0f3d2280bd28a59bd1c5acd to your computer and use it in GitHub Desktop.
Example of agg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.DataFrame({ 'color' : ['Blue', 'Blue', 'Green'], 'name' : ['Bernard', 'Bernard', 'Bernard']}) | |
print df.groupby(['name']).agg(lambda x:x.value_counts().index[0]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment