cenpy.products._Product.from_place

_Product.from_place(self, place, variables=None, place_type=None, level='tract', return_geometry=True, geometry_precision=2, strict_within=True, return_bounds=False, replace_missing=True)[source]

Query the Census for the given place.

placestr

description of the place. Should be of the form “place, state” or “place”

place_typestr

type of place to focus on, Incorporated Place, County Subdivision, or Census Designated Place.

variableslist or str

variable or set of variables to extract from the API. Can include regex columns, which will match to any column in the product. So, [‘P001001’, ‘^P002’] will match to P001001 and any column that starts with P002.

levelstr (default: ‘tract’)

level at which to extract the geographic data. May be limited by some products to only involve tracts. (default: ‘tract’)

return_geometrybool

whether to return the geometries of the queried records. True by default, this will ensure that the return type of from_place is a geopandas.GeoDataFrame. If False, then only the records are fetched; none of the records’ geometries are requested from the server. (default: True)

geometry_precisionint

number of decimal places to preserve when getting the geometric information around each observation in level. (default: 2)

strict_withinbool

whether to retain only geometries that are fully within the target place.

return_boundsbool

whether to return the boundary of the place being queried. (default: False)

replace_missingbool

whether to replace missing values in the data with numpy.nan, according to the standard missing values used by the ACS. (default: True)

Notes

You should always try to provide a place_type. There is a significant amount of vagueness in what is meant by “place” that you may not get the match you intend if you do not provide a place_type.