Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas select first within groupby

>>> df.groupby('id').first().reset_index()
   id   value
0   1   first
1   2   first
2   3   first
3   4  second
4   5   first
5   6   first
6   7  fourth
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pandas #select #groupby
ADD COMMENT
Topic
Name
7+9 =