pudl.transform.censuspep¶
Transform Census PEP FIPS codes data.
Functions¶
|
Create a cleaned up table of FIPS codes. |
Module Contents¶
- pudl.transform.censuspep._core_censuspep__yearly_geocodes(raw_censuspep__geocodes)[source]¶
Create a cleaned up table of FIPS codes.
There are three stages of amendments done to the raw table:
we add in a
state
column with the state abbreviationwe squish the raw two digit
state_id_fips
with the raw three digitcounty_id_fips
to get the full 5 digit code (these codes are all codes of integers but there are meaningful leading zeros so they have nullable string dtypes).we add in territories that are missing from Census PEP FIPS codes.
There are state fips codes in the pudl-compiled POLITICAL_SUBDIVISIONS, but we use the census based codes here so that everything is coming from the same primary source (though I checked and they are all the same).
Sources of territories:
Main page: https://www.census.gov/library/reference/code-lists/ansi.html
txt file: https://www2.census.gov/geo/docs/reference/codes2020/national_county2020.txt
There are only a small number of territory counties that were not in PEP. For 2020, all of the territories are at the bottom of the txt file. PEP had Puerto Rico so everything besides PR was migrated over. A fips_level of 050 was added to all of the counties to match the fips_level from PEP.