The information obtained from the 2020 Census will determine, among other things, funding distribution, grants assignments and the general organization of towns and cities

At NewsCounts we searched the codes of each state for population thresholds that determine whether a city receives certain funding or certain rights. To do so we used the FindLaw website to search for such thresholds. First we scraped FindLaw website, saved the results into a CSV and then searched that CSV file for the most useful codes.

Some examples of the population thresholds that we have found are:

We think that this work can be useful for journalists. Finding interesting population thresholds can help write compelling stories about the 2020 Census. The goal of this document is to explain what we did so anyone interested can follow and replicate it.

Web scraping

You can find the Python code we used for web scraping here.

What this code does is it opens the FindLaw website and stores all legal codes of a specific state found by the FindLaw search box. These codes are stored in a CSV file, one for each state. The CSV file for the states we have done so far can be found in the “Data” folder of this GitHub repository. If you need the file for a state that is not in this folder, please contact us and we will happily add it.

This is an example of one of the files:

title href text
Montana Title 15. Taxation § 15-70-101. Disposition of funds https://codes.findlaw.com/mt/title-15-taxation/mt-code-ann-sect-15-70-101.html (1) Those funds allocated to cities, towns, counties, and consolidated city-county governments in th
Montana Title 16. Alcohol and Tobacco § 16-4-502. Census https://codes.findlaw.com/mt/title-16-alcohol-and-tobacco/mt-code-ann-sect-16-4-502.html
Montana Title 60. Highways and Transportation § 60-3-211. Apportionment of state funds to urban highway system https://codes.findlaw.com/mt/title-60-highways-and-transportation/mt-code-ann-sect-60-3-211.html (1) Each fiscal year, the department shall apportion the federal-aid highway funds allocated for the
Montana Title 60. Highways and Transportation § 60-3-206. Apportionment of funds to secondary highway system https://codes.findlaw.com/mt/title-60-highways-and-transportation/mt-code-ann-sect-60-3-206.html (1) Each fiscal year the department shall apportion at least 65% of the federal-aid highway funds al
Montana Constitution Art. V, § 14. Districting and apportionment https://codes.findlaw.com/mt/montana-constitution/mt-const-art-v-sect-14.html (1) The state shall be divided into as many districts as there are members of the house, and each di
Montana Title 5. Legislative Branch § 5-1-101. Commission to redistrict and reapportion–number of legislators https://codes.findlaw.com/mt/title-5-legislative-branch/mt-code-ann-sect-5-1-101.html (1) In each session preceding each federal population census, a commission of five citizens, none of

Searching the codes

Now that we have the legal codes in a CSV file, we may search for the codes that mention population thresholds in which we might be interested. To do so we looked in the “text” column and filtered all registers that meet the following conditions:

Here you can find the Python code we used to search within the code list. Feel free to use it and to change the terms being searched in order to accomplish your specific goal.

This search can also be done in Excel by adding a “Filter” column at the end of the table and then filtering the table by this “Filter” column. An example of this “Filter” column could be:
“=AND(ISNUMBER(SEARCH(C2,‘census’)), ISNUMBER(SEARCH(C2,‘population’)), ISNUMBER(SEARCH(C2,‘grant’)))”

Montana courts example

According to code “Montana Title 3. Judiciary, Courts § 3-6-101. Establishment of court” a city with a population of 4,000 or more, according to the last federal census, may have a court, known as the municipal court of the city of (designating the name of the city) of the state of Montana.

Using data of the 2010 Census we can search for cities that came short of reaching a population of 4,000, which would have allowed them to have a court.

city population2010
Hardin city, Montana 3505
Shelby city, Montana 3376

Hardin and Shelby are the cities that came closer to hitting the 4,000 mark. 2020 Census is then an opportunity to get a municipal court.

Questions?

NewsCounts is happy to answer any questions you may have about the code. Feel free to email Bernardo at . Also, join the NewsCounts Slack channel to ask for help or continue the conversation.