actual data headI am stuck in a following problem, image is my dataframe
The image is my dataframe in which list of state is very long which includes different states of USA as index and other 2 columns has information about counties in it and Census population 2010.
My aim is to only looking at the three most populous counties for each state, what are the three most populous states (in order of highest population to lowest population)? Use CENSUS2010POP
.
This function should return a list of string values.
df = pd.DataFrame({'State': ['A', 'A','A','A','A','B','B','B','B','B','B','C','C','C','C','C', 'D','D', 'D', 'D'],
'County': ['Aa', 'Ab','Ac','Ad', 'Ae', 'Ba','Ba','Bb','Bc','Bd','Be','Ca','Cb','Cc','Cd','Ce','Da','Db','Dc','Dd'],
'Population': [25,35,45,60,12,80,45,60,20,30,14,65,87,65,13,29,45,60,75,80]})