Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas groupby most frequent

source.groupby(['Country','City'])['Short name'].agg(pd.Series.mode)

Country  City            
Russia   Sankt-Petersburg    Spb
USA      New-York             NY
Name: Short name, dtype: object
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #groupby #frequent
ADD COMMENT
Topic
Name
2+5 =