US Congressional Apportionment Calculator

Following the release of apportionment population data in April 2021, each state was allocated a particular number of Congressional representatives. Apportionment populations are slightly different from the standard census population counts, as they consist of “the resident population of the 50 states including overseas federal employees (military and civilian) and their dependents living with them.”

Interestingly enough, there are multiple different ways that seats could be apportioned based on population data, each with various tradeoffs in terms of privileging larger or smaller states. Since 1941, apportionment values have been calculated using the Huntington-Hill method. Generally speaking, the Huntington-Hill method calculates a priority number for each state and a particular seat number (for example Delaware having a 2nd Congressional District and Texas having an 88th Congressional district). These priority numbers are then ranked, and with slight modifications in order depending on the minimum seats required for each state, the remaining number of seats are selected in order.

Because the Huntington-Hill method is somewhat tricky to implement, and calculators employing it appear hard to find, I created a Congressional Apportionment Calculator in Google Sheets that allows you to enter population values for every state, and then to calculate how many Congressional seats would be allocated to every state based off of those figures.

The notebook has been written where cells in blue are editable by any viewer of the document.

Screenshot of the apportionment calculator

The calculator also includes fields to include DC as a state, and to change the minimum and maximum of seats per state, as well as the total number of states. The second tab in the spreadsheet includes two maps, which plot the total number of seats for each state under the modified populations, as well as the difference in seats per state compared with the seats that were actually allocated.

Using the calculator, you can see things like:
– How apportionment would have changed if New York’s apportionment population was just 89 people larger
– How apportionment would change if DC were counted as a state
– How apportionment, and a state’s percentage of all seats would change if Congress was expanded.

Please note:
– Unfortunately, Google Sheets does not support including Washington, DC among its state maps.
– Changing the minimum seats per state to 0 may result in whacky outputs, particularly because the definition of the method begins with each state being allocated one seat.

Technically speaking, the spreadsheet utilizes a function I wrote in Google Apps script, and was a good chance to practice some Javascript. With some additional time, I could try to add an option for Puerto Rico, and link the results of this analysis with those discussed in an earlier post Counties and Cities with the Most Influence on US Federal Elections.

State Adjacency Portmanteaus

A border portmanteau is a region or town near a mutual border that combines the names of two, or occasionally three, adjacent states. The most famous example is probably “Texarkana” which is a combination of Texas, Arkansas and Louisiana. There is a Texarkana, TX and a Texarkana, AR. Having seen “Pen Mar, MD” on the map, I was curious as to which state borders have a border portmanteau.

I generated the border geometries using a slightly modified version of the adjacency code described here. The data came from the “Border portmanteaus” section of the List of geographic portmanteaus Wikipedia article. Some border portmanteaus no longer exist (ex. Nosodak, ND) or have no current population (Oklarado, CO) but are included anyway.

Mapping and Analyzing 16 Years of Data on Top HS Basketball Recruits

For this post, I analyzed ESPN100 men’s HS basketball prospect ratings from 2007 to 2022. For a given year, the dataset looks something like this:

Example of 2022 ESPN100 dataset

For this analysis, I cleaned the dataset and used API Ninja to Geocode hometown information. I ended up analyzing:
– Basic player information like name, height, and weight
– Top high schools for producing ESPN100 players and the colleges players most frequently attend
– Maps of where ESPN100 players come from each year and over time
– Maps of where particular colleges’ ESPN100 players come from
– An analysis of ESPN100 players forgoing college basketball

Notes and some additional information on processing are including at the bottom of the post. In general, I did not edit the dataset and primarily filled in gaps where they existed. The original dataset was accessed manually through the ESPN100 website.

Basic Prospect Data (Names, Height, Weight)

Names

The most common name for ESPN100 recruits from 2007 to 2022 is either Jordan or Jalen, with 21 recruits each having those names. The other names are:
  1. Jordan – 21 recruits
  2. Jalen – 21 recruits
  3. Brandon – 19 recruits
  4. Isaiah – 16 recruits
  5. Josh – 15 recruits
  6. Chris – 15 recruits
  7. Anthony – 14 recruits
  8. Justin – 14 recruits
  9. Tyler – 14 recruits
  10. James – 13 recruits

Height

The tallest player in the dataset is Mamadou Ndiaye, who is listed at 7’5″. Ndiaye was the #74 ranked player in 2013 and went on to play basketball at UC Irvine.

The shortest player in the dataset is Erving Walker, who is listed at 5’6″. Walker was the #75 ranked player in 2008 and went on to play basketball at Florida.

View the full distribution below:

Histogram of player heights from ESPN100 from 2007 to 2022

Weight

The heaviest player in the dataset is Sim Bhullar, who is listed at 7’4″ and 330 lbs. Bhullar was the #82 ranked player in 2011 and went on to play basketball at New Mexico State before becoming the first player of Indian descent to play in the NBA.

There are 8 different players tied for the lightest player in the dataset at 150 pounds.

View the full distribution below:

Histogram of player weights from ESPN100 from 2007 to 2022

Top High Schools and Colleges

The graphic below shows the high schools or prep schools that had the most ESPN100 prospects.

High schools that produced the most ESPN100 prospects

In terms of colleges signing the highest number of ESPN100 recruits, Kentucky and Duke are a clear tier above the rest.

Colleges that recruited the most ESPN100 prospects

Recruits by Hometown Every Year and in Total

The two graphics depict where ESPN100 recruits came from in a given year. Some possible trends include a lot fewer players from the Bay Area over time and more players from the Twin Cities and Seattle.

Mapping where top basketball players came from on ESPN100 in total across 2007 to 2022

Where Colleges Get Their Recruits

The following section shows maps for the 76 schools that signed more than 5 ESPN100 recruits from 2007 to 2022. The slideshow is loaded in descending order, with schools with more numbers of recruits at the beginning. For each school, the map plots the hometown of every recruit they signed, with a catchall “Overseas” category.

In many cases, one could come pretty close to guessing the school just by the location of its top recruits.

Players Forgoing College Basketball

During this time period, players were not allowed to enter the NBA directly out of high school. Nonetheless, 26 players on the list did not end up signing with a college to play basketball. The number of such players peaked at 8 in 2020, which coincided with the inaugural season of the NBA G League Ignite.

Graphic depicting ESPN100 prospects

Notable prospects to forgo college basketball (2007 – 2002):
  • Jaden Hardy: #2 in ’21
  • Jalen Green: #1 in ’20
  • Jonathan Kuminga: #4 in ’20
  • LaMelo Ball: #21 in ’19
  • Anfernee Simons: #9 in ’18
  • Mitchell Robinson: #11 in ’17
  • Emmanuel Mudiay: #5 in ’14
  • Brandon Jennings: #1 in ’08
  • Terrelle Pryor: #39 in ’08
Note: Terrelle Pryor appears to be the only player from 07-22 to forgo basketball entirely. He went on to play football at Ohio State

Data Processing and Cleaning

For each class year, the ESPN100 data provides the following fields
– Rank
– Player Name
– Position
– Hometown (including High School name and City / State)2
– Height
– Weight
– Stars
– Grade (0 to 100 recruit grade determined by ESPN)
– College (School where they signed or committed)

A few notes about the dataset:
– For the “Hometown” field, the City / State information is not always the City / State of the High School, and appears to be the actual City / State where the player is from. At least for this analysis, I am more interested in a player’s hometown and not the location of the school where they played their basketball season. See (appendix) for more details.
– The dataset includes international recruits.
– In the original ESPN100 dataset, not every player has complete “College” data. In most cases the name of the college where they signed a letter of intent is listed, but in some cases, the field just lists where a player committed to play or simply provides a list of school
– In certain cases, a single college or destination is not provided, in those instances I looked into the player’s career and generally marked where they played next played basketball.

Notes

1 For whatever reason, ESPN100 does not always list exactly 100 recruits, and in some years, fewer recruits are listed.

2 Many elite HS basketball recruits attend high schools or prep schools to play basketball. In general, it seems like the ESPN100 list provides the name of the high school or prep school but the city and state of the player’s hometown, and not the location of the school. For example, Brandon Jennings is listed as “Los Angeles, CA Oak Hill Academy” in the dataset, even though Oak Hill Academy is in Mouth of Wilson, VA. I deferred to ESPN and did not significantly edit these values.

Zip Codes, ZCTAs and ZCTAs that Cross State Boundaries

Zip codes are used by the United States Postal Service (USPS) to deliver mail and are not always polygon areas. The Census Bureau releases Zip Code Tabulation Areas which approximate the boundaries of zip codes. Zip Code Tabulation Areas do not cover the entire country, as represented by the grey areas in the maps below.

One problem that comes up when working with Zip Codes is the fact that some Zip Codes contain areas in multiple states. While this does not use official USPS zip code data, the lower map shows Zip Code Tabulation areas that cross state lines, of which there are 137.

The below table lists out the ZCTAs highlighted in red above.

ZCTA5 States Number of States
86514 {UT, NM, AZ} 3
82082 {WY, NE, CO} 3
57717 {MT, SD, WY} 3
71749 {AR, LA} 2
69168 {NE, CO} 2
69201 {SD, NE} 2
69212 {SD, NE} 2
69216 {SD, NE} 2
69337 {SD, NE} 2
71953 {OK, AR} 2
71937 {OK, AR} 2
72338 {TN, AR} 2
72644 {MO, AR} 2
73949 {OK, TX} 2
75556 {AR, TX} 2
79835 {NM, TX} 2
69026 {KS, NE} 2
02861 {MA, RI} 2
79922 {NM, TX} 2
66541 {KS, NE} 2
59275 {ND, MT} 2
59847 {ID, MT} 2
63673 {MO, IL} 2
65729 {MO, AR} 2
65733 {MO, AR} 2
65761 {MO, AR} 2
66955 {KS, NE} 2
68978 {KS, NE} 2
68325 {KS, NE} 2
68327 {KS, NE} 2
68420 {KS, NE} 2
68719 {SD, NE} 2
68755 {SD, NE} 2
68943 {KS, NE} 2
79837 {NM, TX} 2
81120 {NM, CO} 2
80737 {NE, CO} 2
86515 {NM, AZ} 2
99128 {ID, WA} 2
99033 {ID, WA} 2
97913 {ID, OR} 2
97910 {ID, OR} 2
97635 {CA, OR} 2
89832 {ID, NV} 2
89439 {CA, NV} 2
89421 {OR, NV} 2
89061 {CA, NV} 2
89060 {CA, NV} 2
89019 {CA, NV} 2
89010 {CA, NV} 2
88430 {NM, TX} 2
87328 {NM, AZ} 2
86504 {NM, AZ} 2
59221 {ND, MT} 2
86044 {UT, AZ} 2
84536 {UT, AZ} 2
84531 {UT, AZ} 2
84034 {UT, NV} 2
83856 {ID, WA} 2
83342 {UT, ID} 2
83127 {ID, WY} 2
83120 {ID, WY} 2
82930 {UT, WY} 2
82801 {MT, WY} 2
82701 {SD, WY} 2
82063 {WY, CO} 2
81324 {UT, CO} 2
81137 {NM, CO} 2
59270 {ND, MT} 2
58653 {ND, SD} 2
03579 {NH, ME} 2
38549 {TN, KY} 2
54540 {MI, WI} 2
52626 {MO, IA} 2
52573 {MO, IA} 2
52542 {MO, IA} 2
51640 {MO, IA} 2
51557 {IA, NE} 2
51360 {MN, IA} 2
51023 {SD, IA} 2
51001 {SD, IA} 2
42602 {TN, KY} 2
42223 {TN, KY} 2
40965 {TN, KY} 2
38852 {AL, MS} 2
38769 {AR, MS} 2
38326 {TN, MS} 2
56136 {MN, SD} 2
38079 {TN, KY} 2
37752 {VA, TN} 2
37642 {VA, TN} 2
36855 {AL, GA} 2
30741 {TN, GA} 2
30165 {AL, GA} 2
28675 {NC, VA} 2
27048 {NC, VA} 2
24622 {VA, WV} 2
24604 {VA, WV} 2
21912 {DE, MD} 2
21874 {DE, MD} 2
20135 {VA, WV} 2
19973 {DE, MD} 2
56027 {MN, IA} 2
56144 {MN, SD} 2
58649 {ND, SD} 2
57660 {ND, SD} 2
58639 {ND, SD} 2
58623 {ND, SD} 2
58621 {ND, MT} 2
58568 {ND, SD} 2
58439 {ND, SD} 2
58436 {ND, SD} 2
58413 {ND, SD} 2
58225 {ND, MN} 2
58053 {ND, SD} 2
58043 {ND, SD} 2
58041 {ND, SD} 2
58030 {ND, MN} 2
57735 {SD, NE} 2
57724 {MT, SD} 2
57648 {ND, SD} 2
56164 {MN, SD} 2
57645 {ND, SD} 2
57642 {ND, SD} 2
57641 {ND, SD} 2
57638 {ND, SD} 2
57430 {ND, SD} 2
57255 {ND, SD} 2
57068 {MN, SD} 2
57034 {SD, IA} 2
57030 {MN, SD} 2
57026 {MN, SD} 2
56744 {ND, MN} 2
56257 {MN, SD} 2
56220 {MN, SD} 2
56219 {MN, SD} 2
99362 {WA, OR} 2

Moving Alaska and Hawaii for Mapping in National Maps

Problems Mapping Alaska and Hawaii

As anyone who has tried to make a map of the United States would tell you, the true locations of Alaska and Hawaii make creating good national maps difficult. Including these two states in their true locations leaves a lot of blank space on the map. As such, maps will oftentimes either cut out Alaska and Hawaii and only show the continental United States or resize and move them so as they appear close to the other states. The latter option is definitely preferable if you want to include Alaska and Hawaii in your map.

Scaling and Translating Alaska and Hawaii

Scaling changes the size of a geometry and translating it moves left, right, up or down. Given Alaska’s size, particularly in coordinate reference systems like 3857, Alaska and Hawaii need to be scaled and translated to fit in nicely with the lower 48 states. One quirk with scaling geographic data is that if you are attempting to plot sub-state geographies of Alaska and Hawaii, the scaling step may pull these geographies apart, as in the example below:

In the above map, the counties in Alaska and Hawaii being plotted are not scaled around a fixed point, but instead to the center of their own respective geometries. This is mostly fine for Hawaii as its counties largely consist of islands, but destroys the county adjacency relationship in Alaska. If you scale the county geometries around a fixed point however, the adjacency relationships are maintained and Alaska looks just like you’d expect it to, as in the map below:

Code to Scale and Translate Alaska and Hawaii

I’ve had to perform this operation many times and have found myself digging back into old code to find the exact numbers used in the scaling and translation. The code below includes the necessary scaling and translation to move data for Alaska and Hawaii in a Python GeoDataFrame to these locations.

The fourth parameter used when performing the scale operation is the fixed point. Please note that the code currently modifies the GeoDataFrame to be in crs 3857. For other coordinate reference systems, different scaling and translating values may be required.

The code takes in a GeoDataFrame containing data for Alaska and Hawaii, a string to refer to the column name where Alaska and Hawaii can be filtered and then inputs for the values for Alaska and Hawaii in that column.

def move_alaska_hawaii(gdf, filter_col, ak_id, hi_id):
    
    gdf = gdf.to_crs(3857)
        
    alaska = gdf[gdf[filter_col] == ak_id]
    hawaii = gdf[gdf[filter_col] == hi_id]
    
    remaining = gdf[~gdf[filter_col].isin([ak_id, hi_id])]
    
    alaska = alaska.set_geometry(alaska.scale(.2,.2,.2,(-13452629.057,3227683.786)).translate(.215e7, -1.36e6))
    hawaii = hawaii.set_geometry(hawaii.scale(1.5,1.5,1.5,(-14384434.819, 2342560.248)).translate(.57e7, 1e6))
    
    gdf = gp.GeoDataFrame(pd.concat([alaska, hawaii, remaining]), crs = 3857)
        
    return gdf

Python GeoDataFrame Dissolve on Adjacencies

Python code to dissolve geopandas GeoDataFrames on adjacent geometries, with parameters to include or exclude point adjacencies.

Find the most up-to-date version of the code here.

import geopandas as gp
from itertools import combinations, starmap

def adjacency_dissolve(gdf, include_point_adjacency = True):
    '''
    Code that takes in a geodataframe and returns the geodataframe with adjacencies dissolved
    Includes a "include_point_adjacency" parameter, with a default value set to "True"
    Currently the code is not fine-tuned to handle non-geometric data during the dissolve 
    '''
    # Make sure that the index column is unique
    if "index" in gdf.columns:
        raise ValueError("Column already named 'index'")
        
    gdf.reset_index(inplace = True, drop = False)
    
    if not gdf.index.is_unique:
        raise ValueError ("Non-unique index column")
    
    adj_groups = calculate_adjacency(gdf, include_point_adjacency)
    
    if "Dissolve_Assignment" in gdf.columns:
        raise ValueError("Existing 'Dissolve_Assignment' column")
    
    gdf["Dissolve_Assignment"] = ""
    for i in range(0,len(adj_groups)):
        if type(adj_groups[i])==gdf.dtypes["index"]:
            gdf.loc[gdf["index"]== adj_groups[i],"Dissolve_Assignment"] = i
        elif type(adj_groups[i])==set:
            gdf.loc[gdf["index"].isin(adj_groups[i]) ,"Dissolve_Assignment"] = i
    
    dissolved = gdf.dissolve("Dissolve_Assignment")
    dissolved.reset_index(drop = False, inplace = True)
    dissolved.drop(["index","Dissolve_Assignment"], axis = 1, inplace = True)
    
    return dissolved


def calculate_adjacency(gdf, include_point_adjacency = True):
    '''
    Code that takes a geodataframe and returns a dictionary of adjacencies
    '''    
    # Intersected the GeoDataFrame with the buffer with the original GeoDataFrame
    test_intersection = gp.overlay(gdf, gdf, how = "intersection", keep_geom_type = False)
    
    # If the include_point_adjacency is False
    if (include_point_adjacency == False):
        # Filter out the intersections that are just points
        test_intersection = test_intersection[test_intersection.geom_type != "Point"]
    
    # Get value counts after the intersections
    ser = test_intersection["index_1"].value_counts()
    
    # Filter out self-intersections
    test_intersection = test_intersection[test_intersection["index_1"]!=test_intersection["index_2"]]
    
    # Define a tuple of zips of the unique_col pairs present in the intersection
    test_intersection_tuples = list(list(zip(test_intersection["index_1"], test_intersection["index_2"])))
    
    return subadjacencies_faster_3([set(i) for i in test_intersection_tuples]) + list(ser[ser==1].index)

def subadjacencies_faster_3(dup_list):
    all_intersections = starmap(set.intersection, combinations(dup_list, 2))
    finished = True
    for val in all_intersections:
        if val != set():
            finished = False
    if finished:
        return [sorted(list(i)) for i in dup_list]
    else:
        final_holder = []
        for val in dup_list:
            added = False
            added_indices = []
            for idx, x in enumerate(final_holder):
                if len(x.intersection(val)) > 0:
                    final_holder[idx] = x.union(val)
                    added_indices.append(idx)
                    added = True
            if len(added_indices) > 1:
                for i in range(1, len(added_indices)):
                    final_holder[added_indices[0]] = final_holder[added_indices[0]].union(final_holder[added_indices[i]])
                for i in range(len(added_indices)-1,0,-1):
                    final_holder.pop(added_indices[i])
            if not added:
                final_holder.append(val)
        return final_holder

County-Level 2000 – 2016 Presidential Election Result Maps

Using election results data from MEDSL, I was able to make maps showing county-level presidential election results for the 2000, 2004, 2008, 2012, and 2016 presidential elections.

Interesting Findings

– No third-party candidate won any county in these 5 elections
– No county had a tie between the top two vote getters
– No county voted for the losing candidate in every election: (00-D, 04-D, 08-R, 12-R, 16-D)
– 39 counties voted: (00-D, 04-D, 08-R, 12-R, 16-R), only getting their first winner in 2016

Maps

(Please note: the maps are fairly high resolution, which means they may take a second to load. If you are struggling to view the counties, you can open the image in a new tab and enlarge the image)

How Counties Voted in Presidential Elections from 200o to 2016

Given the large number of different outcomes, it’s a bit easier to view the data by splitting the map into counties that voted Democratic in 2000 and counties that voted Republican:

Notes

– “INCOMPLETE” refers to Broomfield County, which became a new county in 2001. The boundaries in surrounding counties changed slightly as a result of this change.
– Election data from MEDSL and county shapes from the Census
– My apologies to Hawaii and Alaska, which will be included in future versions of this post

Geopandas Shapefile Adjacency

The below code takes in a geodataframe and a unique column and returns a dictionary mapping from each unique column value to a list of the column values it is adjacent too.

As written, the code uses a buffer of 1 in the 3857 crs and, as you can see below, accounts for point (Queen’s) adjacency.

The next version of the code will attempt to do the same thing without using a buffer and return an adjacency matrix rather than a dictionary.

def calculate_adjacency(gdf, unique_col):
    '''
    Code that takes a geodataframe and returns a dictionary of adjacencies
    '''
    
    # Convert to a crs to make sure the buffer area works
    gdf = gdf.to_crs(3857)
    
    # Make a copy of the GeoDataFrame
    gdf_buffer = gdf.copy(deep = True)
    
    # Add a buffer of 1 to the geometry of the copied GeoDataFrame
    gdf_buffer["geometry"] = gdf.buffer(1)
    
    # Intersected the GeoDataFrame with the buffer with the original GeoDataFrame
    test_intersection = gp.overlay(gdf_buffer, gdf, how = "intersection")
    
    # Define a tuple of zips of the unique_col pairs present in the intersection
    test_intersection_tuples = tuple(zip(test_intersection[unique_col+"_1"], test_intersection[unique_col+"_2"]))
    
    # Define a dictionary that will map from a unique_col value to a list of other unique_cols it is adjacent to
    final_dict = {}
    
    # Iterate over the tuples
    for val in test_intersection_tuples:
        
        # The shapes will intersect with themselves, we don't want to add these to the dictionary
        if val[0] != val[1]:
            
            # If the shape is already in the dictionary
            if val[0] in list(final_dict.keys()):
                
                # Append the adjacent shape to the list
                holder = final_dict[val[0]]
                holder.append(val[1])
                final_dict[val[0]] = holder
            else:
                
                # Otherwise, create a key in the dictionary mapping to a list with the adjacenct shape
                final_dict[val[0]] = [val[1]]
                
    # Some shapes will only intersect with themselves and not be added to the above
    for val in [i for i in gdf[unique_col] if i not in list(final_dict.keys())]:
        
        # For each of these, add a blank list to the dictionary
        final_dict[val] = []
        
    # Return the adjacency dictionary    
    return final_dict

Example output from running the code on a shape file of the US States from the census.

Census State FIPs Dictionary

Summary

It can be hard to find easily usable datasets that link state names or abbreviations to state FIPS codes.

On this page, I’ve copied 4 Python dictionaries with this correspondence. You can also download them in .csv format (note due to WordPress issues they are technically saved as .txt files)

  1. State Name to State FIPS (csv)
  2. State FIPS to State Name (csv)
  3. State Abbreviation to State FIPS (csv)
  4. State FIPS to State Abbreviation (csv)

The source of the data is the Natural Resources Conservation Service

State Name to State FIPS:

state_name_fips_dict = {
 'Alabama': '01',
 'Alaska': '02',
 'Arizona': '04',
 'Arkansas': '05',
 'California': '06',
 'Colorado': '08',
 'Connecticut': '09',
 'Delaware': '10',
 'Florida': '12',
 'Georgia': '13',
 'Hawaii': '15',
 'Idaho': '16',
 'Illinois': '17',
 'Indiana': '18',
 'Iowa': '19',
 'Kansas': '20',
 'Kentucky': '21',
 'Louisiana': '22',
 'Maine': '23',
 'Maryland': '24',
 'Massachusetts': '25',
 'Michigan': '26',
 'Minnesota': '27',
 'Mississippi': '28',
 'Missouri': '29',
 'Montana': '30',
 'Nebraska': '31',
 'Nevada': '32',
 'New Hampshire': '33',
 'New Jersey': '34',
 'New Mexico': '35',
 'New York': '36',
 'North Carolina': '37',
 'North Dakota': '38',
 'Ohio': '39',
 'Oklahoma': '40',
 'Oregon': '41',
 'Pennsylvania': '42',
 'Rhode Island': '44',
 'South Carolina': '45',
 'South Dakota': '46',
 'Tennessee': '47',
 'Texas': '48',
 'Utah': '49',
 'Vermont': '50',
 'Virginia': '51',
 'Washington': '53',
 'West Virginia': '54',
 'Wisconsin': '55',
 'Wyoming': '56',
 'American Samoa': '60',
 'Guam': '66',
 'Northern Mariana Islands': '69',
 'Puerto Rico': '72',
 'Virgin Islands': '78'}

State FIPS to State Name:

fips_state_name_dict = {
 '01': 'Alabama',
 '02': 'Alaska',
 '04': 'Arizona',
 '05': 'Arkansas',
 '06': 'California',
 '08': 'Colorado',
 '09': 'Connecticut',
 '10': 'Delaware',
 '12': 'Florida',
 '13': 'Georgia',
 '15': 'Hawaii',
 '16': 'Idaho',
 '17': 'Illinois',
 '18': 'Indiana',
 '19': 'Iowa',
 '20': 'Kansas',
 '21': 'Kentucky',
 '22': 'Louisiana',
 '23': 'Maine',
 '24': 'Maryland',
 '25': 'Massachusetts',
 '26': 'Michigan',
 '27': 'Minnesota',
 '28': 'Mississippi',
 '29': 'Missouri',
 '30': 'Montana',
 '31': 'Nebraska',
 '32': 'Nevada',
 '33': 'New Hampshire',
 '34': 'New Jersey',
 '35': 'New Mexico',
 '36': 'New York',
 '37': 'North Carolina',
 '38': 'North Dakota',
 '39': 'Ohio',
 '40': 'Oklahoma',
 '41': 'Oregon',
 '42': 'Pennsylvania',
 '44': 'Rhode Island',
 '45': 'South Carolina',
 '46': 'South Dakota',
 '47': 'Tennessee',
 '48': 'Texas',
 '49': 'Utah',
 '50': 'Vermont',
 '51': 'Virginia',
 '53': 'Washington',
 '54': 'West Virginia',
 '55': 'Wisconsin',
 '56': 'Wyoming',
 '60': 'American Samoa',
 '66': 'Guam',
 '69': 'Northern Mariana Islands',
 '72': 'Puerto Rico',
 '78': 'Virgin Islands'}

State Abbreviation to State FIPS:

state_abbrev_fips_dict = {
 'AL': '01',
 'AK': '02',
 'AZ': '04',
 'AR': '05',
 'CA': '06',
 'CO': '08',
 'CT': '09',
 'DE': '10',
 'FL': '12',
 'GA': '13',
 'HI': '15',
 'ID': '16',
 'IL': '17',
 'IN': '18',
 'IA': '19',
 'KS': '20',
 'KY': '21',
 'LA': '22',
 'ME': '23',
 'MD': '24',
 'MA': '25',
 'MI': '26',
 'MN': '27',
 'MS': '28',
 'MO': '29',
 'MT': '30',
 'NE': '31',
 'NV': '32',
 'NH': '33',
 'NJ': '34',
 'NM': '35',
 'NY': '36',
 'NC': '37',
 'ND': '38',
 'OH': '39',
 'OK': '40',
 'OR': '41',
 'PA': '42',
 'RI': '44',
 'SC': '45',
 'SD': '46',
 'TN': '47',
 'TX': '48',
 'UT': '49',
 'VT': '50',
 'VA': '51',
 'WA': '53',
 'WV': '54',
 'WI': '55',
 'WY': '56',
 'AS': '60',
 'GU': '66',
 'MP': '69',
 'PR': '72',
 'VI': '78'}

State FIPS to State Abbreviation:

fips_state_abbrev_dict = {
 '01': 'AL',
 '02': 'AK',
 '04': 'AZ',
 '05': 'AR',
 '06': 'CA',
 '08': 'CO',
 '09': 'CT',
 '10': 'DE',
 '12': 'FL',
 '13': 'GA',
 '15': 'HI',
 '16': 'ID',
 '17': 'IL',
 '18': 'IN',
 '19': 'IA',
 '20': 'KS',
 '21': 'KY',
 '22': 'LA',
 '23': 'ME',
 '24': 'MD',
 '25': 'MA',
 '26': 'MI',
 '27': 'MN',
 '28': 'MS',
 '29': 'MO',
 '30': 'MT',
 '31': 'NE',
 '32': 'NV',
 '33': 'NH',
 '34': 'NJ',
 '35': 'NM',
 '36': 'NY',
 '37': 'NC',
 '38': 'ND',
 '39': 'OH',
 '40': 'OK',
 '41': 'OR',
 '42': 'PA',
 '44': 'RI',
 '45': 'SC',
 '46': 'SD',
 '47': 'TN',
 '48': 'TX',
 '49': 'UT',
 '50': 'VT',
 '51': 'VA',
 '53': 'WA',
 '54': 'WV',
 '55': 'WI',
 '56': 'WY',
 '60': 'AS',
 '66': 'GU',
 '69': 'MP',
 '72': 'PR',
 '78': 'VI'}