I have the following dataframe:
df = pd.DataFrame({'place' : ['A', 'B', 'C', 'D', 'E', 'F'],
'population': [10 , 20, 30, 15, 25, 35],
'region': ['I', 'II', 'III', 'I', 'II', 'III']})
And it looks like this:
place population region
0 A 10 I
1 B 20 II
2 C 30 III
3 D 15 I
4 E 25 II
5 F 35 III
I would like to select the place with the smallest population from the region with the highest population.
df.groupby('region').population.sum()
Returns:
region
I 25
II 45
III 65
Name: population, dtype: int64
But I have no clue how to proceed from here (using .groupby / .loc / .iloc)
Any suggestion?