Census Data Analysis: States with Most Counties and Populous Counties, Exams of Natural Language Processing (NLP)

Python code snippets to analyze census data and identify the state with the most counties and the three most populous counties in each state. The analysis is based on the 'census.csv' file.

Typology: Exams

2020/2021

Uploaded on 08/13/2021

Radhika123
Radhika123 🇮🇳

1 document

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
census.csv
Q1 Which state has the most counties in it?
x=census_df.groupby(‘STNAME’).count()[‘CTYNAME’]
print(x)
print(max(x))
ans=x.idmax()
print(ans)
Q2 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)?

Partial preview of the text

Download Census Data Analysis: States with Most Counties and Populous Counties and more Exams Natural Language Processing (NLP) in PDF only on Docsity!

census.csv Q1 Which state has the most counties in it? x=census_df.groupby(‘STNAME’).count()[‘CTYNAME’] print(x) print(max(x)) ans=x.idmax() print(ans) Q2 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)?