Posts

Showing posts from March 16, 2019

Ibeas de Juarros

Image
Ibeas de Juarros Herb Państwo   Hiszpania Wspólnota autonomiczna Kastylia i León Prowincja Burgos Zarządzający Juan Manuel Romo Herrera↗ Powierzchnia 130,27 [1] km² Populacja  (2011) • liczba ludności • gęstość 1456 [1] 11,18 os./km² Kod pocztowy 09198 Tablice rejestracyjne BU Położenie na mapie Kastylii i Leónu Ibeas de Juarros Położenie na mapie Hiszpanii Ibeas de Juarros 42°19′56″N   3°32′11″W / 42,332222   -3,536389 Multimedia w Wikimedia Commons Strona internetowa Portal Hiszpania Ibeas de Juarros – gmina w Hiszpanii, w prowincji Burgos, w Kastylii i León, o powierzchni 130,27 [1] km². W 2011 roku gmina liczyła 1456 [1] mieszkańców. Przypisy | ↑ a b c d Ministerio de Hacienda y Administraciones Públicas: Datos del registro de Entidades Locales ( hiszp. ) . [dostęp 2013-06-16]. p   •   d   •   e Gminy prowincji Burgos Abajas Adrada de

Finding the states with the three most populous counties

Image
3 I just started to use Python and Pandas. My current solution to a problem looks ugly and inefficient. I would like to know how to improve it. Data file is Census 2010 can be viewed here Question: 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. Current code def answer_six(): cdf = census_df[census_df['SUMLEV'] == 50] cdf = cdf.groupby('STNAME') cdf = cdf.apply(lambda x:x.sort_values('CENSUS2010POP', ascending=False)).reset_index(drop=True) cdf = cdf.groupby('STNAME').head(3) cdf = cdf.groupby('STNAME').sum() cdf = cdf.sort_values('CENSUS2010POP', a