geo_conversion module¶
- ziptool.geo_conversion.get_state_intersections(state_fips_code: str) geopandas.geodataframe.GeoDataFrame ¶
For a given state, computes the intersections between Census tracts and PUMAs. Note that you most run fetch_data.get_shape_files() before using this function.
- Parameters
state_fips_code – a string representing the FIPS code of the state of interest.
- Returns
a geopandas dataframe detailing the intersections of tracts and PUMAS for a state
- ziptool.geo_conversion.tracts_to_puma(tracts, state_fips_code: str)¶
Takes in a list of tracts and ratios for a given zip code (in a given state) and returns the PUMAs composing the ZIP code with ratios (i.e. 88% in PUMA 00101 and 12% in PUMA 00102).
- Parameters
tracts – a 2D list generated by zip_to_tract containing census tracts and weighted_ratios
state_fips_code – string representing state of interest
- Returns
series containing ratio of population for each PUMA
- ziptool.geo_conversion.zip_to_tract(zipcode: Union[str, int]) Tuple[Tuple[List[str], List[float]], str] ¶
For a given ZIP code, uses HUD Crosswalk data (https://www.huduser.gov/portal/datasets/usps_crosswalk.html) to find the ratio of persons in each census tract for the given ZIP code.
- Parameters
zip – the five-digit ZIP code of interest, written as a string
- Returns
List containing the same number of entries as census tracts within the ZIP code. Each entry is a list, entry 0 is the census tract and entry 1 is the residential ratio of the census tract within that ZIP.