cenpy.products.ACS.from_state¶
-
ACS.
from_state
(self, state, variables=None, level='tract', **kwargs)[source]¶ Query the Census for the given state.
- statestr
description of the state. Should be of the form “state, abbreviation” or “state”
- state_typestr
type of state 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_state 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 states 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 state.
- return_boundsbool
whether to return the boundary of the state being queried. (default: False)
- restate_missingbool
whether to restate 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 state_type. There is a significant amount of vagueness in what is meant by “state” that you may not get the match you intend if you do not provide a state_type.