Skip to content

epymorph.geography.us_census

Geo scope instances that utilize US Census delineations. Generally, each CensusScope describes the granularity of the nodes in scope, plus some containing boundary at the same level of granularity or higher in which all nodes in that boundary are considered in scope. For instance, "give me all of the counties in Nebraska and South Dakota".

CensusScopeT module-attribute

CensusScopeT = TypeVar('CensusScopeT', bound=CensusScope)

The type of geo scope.

CensusSelectionT module-attribute

CensusSelectionT = TypeVar(
    "CensusSelectionT",
    bound=StateSelection
    | CountySelection
    | TractSelection
    | BlockGroupSelection,
)

The type of geo selection.

CensusScope dataclass

CensusScope(
    year: int,
    granularity: CensusGranularityName,
    includes_granularity: CensusGranularityName,
    includes: tuple[str, ...],
)

Bases: ABC, GeoScope

Base class for geo scopes using US Census delineations.

year instance-attribute

year: int

The Census delineation year. Census Bureau can (and does) define new delineations annually, especially at the smaller granularities. Hence, you must know the year in order to absolutely identify a set of delineations.

granularity instance-attribute

granularity: CensusGranularityName

Which granularity are the nodes in this scope?

includes_granularity instance-attribute

includes_granularity: CensusGranularityName

Which granularity defines the bounds of this scope?

includes instance-attribute

includes: tuple[str, ...]

Which nodes (of includes_granularity) are in scope?

node_ids property

node_ids: NDArray[str_]

The list of node IDs included in this scope.

raise_granularity abstractmethod

raise_granularity() -> CensusScope

Returns:

  • CensusScope

    A scope with granularity one level higher than this. This may have the effect of widening the scope; for example, raising a TractScope which is filtered to a set of tracts will result in a CountyScope containing the counties that contained our tracts.

Raises:

lower_granularity abstractmethod

lower_granularity() -> CensusScope

Returns:

  • CensusScope

    A scope with granularity one level lower than this.

Raises:

as_granularity

as_granularity(
    granularity: CensusGranularityName,
) -> CensusScope

Returns:

  • CensusScope

    A scope of the named granularity by either raising or lowering the original scope to match. If granularity already matches this scope, it is returned unchanged.

Raises:

  • GeographyError

    If the granularity cannot be modified as requested.

of staticmethod

of(
    name: CensusGranularityName,
    node_ids: Sequence[str],
    year: int,
) -> CensusScope

Creates a CensusScope instance of the named granularity, using nodes IDs of the same granularity. This is the same as StateScope.in_states(...) for example.

Parameters:

  • name (CensusGranularityName) –

    The name of the Census granularity for the resulting scope.

  • node_ids (Sequence[str]) –

    The node IDs to include in the scope; these IDs must identify nodes of the same granularity as name.

  • year (int) –

    The Census delineation year.

get_info abstractmethod

get_info() -> DataFrame

Retrieve TIGER info for the nodes in this scope. This is very similar to the geography property of CensusScopes, but it omits the shape data so it's a little faster for use-cases that don't need it.

StateScope dataclass

StateScope(
    year: int,
    granularity: CensusGranularityName,
    includes_granularity: Literal["state"],
    includes: tuple[str, ...],
)

Bases: _InStatesMixin, CensusScope

A CensusScope at the US State granularity.

Typically you'll create one of these using all or in_states.

Parameters:

  • year (int) –

    The Census delineation year.

  • includes_granularity (Literal['state']) –

    Which granularity defines the bounds of this scope?

  • includes (tuple[str, ...]) –

    Which nodes (of includes_granularity) are in scope?

year instance-attribute

year: int

The Census delineation year. Census Bureau can (and does) define new delineations annually, especially at the smaller granularities. Hence, you must know the year in order to absolutely identify a set of delineations.

includes_granularity instance-attribute

includes_granularity: Literal['state']

Which granularity defines the bounds of this scope?

includes instance-attribute

includes: tuple[str, ...]

Which nodes (of includes_granularity) are in scope?

granularity class-attribute instance-attribute

granularity: Literal["state"] = field(
    init=False, default="state"
)

Which granularity are the nodes in this scope?

select property

Create a selection from this scope.

labels_option property

labels_option: NDArray[str_]

An optional text label for each node. If this returns None, convention is to use the node IDs as the labels.

geography cached property

geography: GeoDataFrame

Retrieves the shapes corresponding to the nodes of this scope as a GeoDataFrame. Note that this is not possible for all types of GeoScope.

Returns:

Raises:

  • GeographyError

    If we cannot fetch geography for this type of scope.

all classmethod

all(year: int) -> Self

Create a scope including all US states and state-equivalents.

Parameters:

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

is_all_states

is_all_states() -> bool

Returns:

  • bool

    True if this scope includes all supported US states.

raise_granularity

raise_granularity() -> Never

Returns:

  • CensusScope

    A scope with granularity one level higher than this. This may have the effect of widening the scope; for example, raising a TractScope which is filtered to a set of tracts will result in a CountyScope containing the counties that contained our tracts.

Raises:

lower_granularity

lower_granularity() -> CountyScope

Returns:

  • CensusScope

    A scope with granularity one level lower than this.

Raises:

get_info

get_info() -> DataFrame

Retrieve TIGER info for the nodes in this scope. This is very similar to the geography property of CensusScopes, but it omits the shape data so it's a little faster for use-cases that don't need it.

in_states classmethod

in_states(states: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US states/state-equivalents.

Parameters:

  • states (Sequence[str]) –

    The set of states to include. This can be a list of either state names, postal codes, or FIPs codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

CountyScope dataclass

CountyScope(
    year: int,
    granularity: CensusGranularityName,
    includes_granularity: Literal["state", "county"],
    includes: tuple[str, ...],
)

Bases: _InStatesMixin, _InCountiesMixin, CensusScope

A CensusScope at the US County granularity.

Typically you'll create one of these using all, in_states, or in_counties.

Parameters:

  • year (int) –

    The Census delineation year.

  • includes_granularity (Literal['state', 'county']) –

    Which granularity defines the bounds of this scope?

  • includes (tuple[str, ...]) –

    Which nodes (of includes_granularity) are in scope?

year instance-attribute

year: int

The Census delineation year. Census Bureau can (and does) define new delineations annually, especially at the smaller granularities. Hence, you must know the year in order to absolutely identify a set of delineations.

includes_granularity instance-attribute

includes_granularity: Literal['state', 'county']

Which granularity defines the bounds of this scope?

includes instance-attribute

includes: tuple[str, ...]

Which nodes (of includes_granularity) are in scope?

granularity class-attribute instance-attribute

granularity: Literal["county"] = field(
    init=False, default="county"
)

Which granularity are the nodes in this scope?

select property

Create a selection from this scope.

labels_option property

labels_option: NDArray[str_]

An optional text label for each node. If this returns None, convention is to use the node IDs as the labels.

geography cached property

geography: GeoDataFrame

Retrieves the shapes corresponding to the nodes of this scope as a GeoDataFrame. Note that this is not possible for all types of GeoScope.

Returns:

Raises:

  • GeographyError

    If we cannot fetch geography for this type of scope.

all classmethod

all(year: int) -> Self

Create a scope including all US counties and county-equivalents.

Parameters:

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

raise_granularity

raise_granularity() -> StateScope

Returns:

  • CensusScope

    A scope with granularity one level higher than this. This may have the effect of widening the scope; for example, raising a TractScope which is filtered to a set of tracts will result in a CountyScope containing the counties that contained our tracts.

Raises:

lower_granularity

lower_granularity() -> TractScope

Returns:

  • CensusScope

    A scope with granularity one level lower than this.

Raises:

get_info

get_info() -> DataFrame

Retrieve TIGER info for the nodes in this scope. This is very similar to the geography property of CensusScopes, but it omits the shape data so it's a little faster for use-cases that don't need it.

in_counties classmethod

in_counties(counties: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US counties/county-equivalents.

Parameters:

  • counties (Sequence[str]) –

    The set of counties to include. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

in_states classmethod

in_states(states: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US states/state-equivalents.

Parameters:

  • states (Sequence[str]) –

    The set of states to include. This can be a list of either state names, postal codes, or FIPs codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

TractScope dataclass

TractScope(
    year: int,
    granularity: CensusGranularityName,
    includes_granularity: Literal[
        "state", "county", "tract"
    ],
    includes: tuple[str, ...],
)

Bases: _InStatesMixin, _InCountiesMixin, _InTractsMixin, CensusScope

A CensusScope at the US Tract granularity.

Typically you will create one of these using in_states, in_counties, or in_tracts.

Parameters:

  • year (int) –

    The Census delineation year.

  • includes_granularity (Literal['state', 'county', 'tract']) –

    Which granularity defines the bounds of this scope?

  • includes (tuple[str, ...]) –

    Which nodes (of includes_granularity) are in scope?

year instance-attribute

year: int

The Census delineation year. Census Bureau can (and does) define new delineations annually, especially at the smaller granularities. Hence, you must know the year in order to absolutely identify a set of delineations.

includes_granularity instance-attribute

includes_granularity: Literal['state', 'county', 'tract']

Which granularity defines the bounds of this scope?

includes instance-attribute

includes: tuple[str, ...]

Which nodes (of includes_granularity) are in scope?

granularity class-attribute instance-attribute

granularity: Literal["tract"] = field(
    init=False, default="tract"
)

Which granularity are the nodes in this scope?

select property

Create a selection from this scope.

geography cached property

geography: GeoDataFrame

Retrieves the shapes corresponding to the nodes of this scope as a GeoDataFrame. Note that this is not possible for all types of GeoScope.

Returns:

Raises:

  • GeographyError

    If we cannot fetch geography for this type of scope.

raise_granularity

raise_granularity() -> CountyScope

Returns:

  • CensusScope

    A scope with granularity one level higher than this. This may have the effect of widening the scope; for example, raising a TractScope which is filtered to a set of tracts will result in a CountyScope containing the counties that contained our tracts.

Raises:

lower_granularity

lower_granularity() -> BlockGroupScope

Returns:

  • CensusScope

    A scope with granularity one level lower than this.

Raises:

get_info

get_info() -> DataFrame

Retrieve TIGER info for the nodes in this scope. This is very similar to the geography property of CensusScopes, but it omits the shape data so it's a little faster for use-cases that don't need it.

in_tracts classmethod

in_tracts(tracts: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US Census tracts.

Parameters:

  • tracts (Sequence[str]) –

    The set of tracts to include, by ID.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

in_counties classmethod

in_counties(counties: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US counties/county-equivalents.

Parameters:

  • counties (Sequence[str]) –

    The set of counties to include. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

in_states classmethod

in_states(states: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US states/state-equivalents.

Parameters:

  • states (Sequence[str]) –

    The set of states to include. This can be a list of either state names, postal codes, or FIPs codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

BlockGroupScope dataclass

BlockGroupScope(
    year: int,
    granularity: CensusGranularityName,
    includes_granularity: Literal[
        "state", "county", "tract", "block group"
    ],
    includes: tuple[str, ...],
)

Bases: _InStatesMixin, _InCountiesMixin, _InTractsMixin, _InBlockGroupsMixin, CensusScope

A CensusScope at the US Block Group granularity.

Typically you will create one of these using in_states, in_counties, in_tracts, or in_block_groups.

Parameters:

  • year (int) –

    The Census delineation year.

  • includes_granularity (Literal['state', 'county', 'tract', 'block group']) –

    Which granularity defines the bounds of this scope?

  • includes (tuple[str, ...]) –

    Which nodes (of includes_granularity) are in scope?

year instance-attribute

year: int

The Census delineation year. Census Bureau can (and does) define new delineations annually, especially at the smaller granularities. Hence, you must know the year in order to absolutely identify a set of delineations.

includes_granularity instance-attribute

includes_granularity: Literal[
    "state", "county", "tract", "block group"
]

Which granularity defines the bounds of this scope?

includes instance-attribute

includes: tuple[str, ...]

Which nodes (of includes_granularity) are in scope?

granularity class-attribute instance-attribute

granularity: Literal["block group"] = field(
    init=False, default="block group"
)

Which granularity are the nodes in this scope?

select property

Create a selection from this scope.

geography cached property

geography: GeoDataFrame

Retrieves the shapes corresponding to the nodes of this scope as a GeoDataFrame. Note that this is not possible for all types of GeoScope.

Returns:

Raises:

  • GeographyError

    If we cannot fetch geography for this type of scope.

raise_granularity

raise_granularity() -> TractScope

Returns:

  • CensusScope

    A scope with granularity one level higher than this. This may have the effect of widening the scope; for example, raising a TractScope which is filtered to a set of tracts will result in a CountyScope containing the counties that contained our tracts.

Raises:

lower_granularity

lower_granularity() -> Never

Returns:

  • CensusScope

    A scope with granularity one level lower than this.

Raises:

get_info

get_info() -> DataFrame

Retrieve TIGER info for the nodes in this scope. This is very similar to the geography property of CensusScopes, but it omits the shape data so it's a little faster for use-cases that don't need it.

in_block_groups classmethod

in_block_groups(
    block_groups: Sequence[str], year: int
) -> Self

Create a scope including all nodes in a set of US Census block groups.

Parameters:

  • block_groups (Sequence[str]) –

    The set of block groups to include, by ID.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

  • GeographyError

    If the year or any entry in block_groups is invalid.

in_tracts classmethod

in_tracts(tracts: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US Census tracts.

Parameters:

  • tracts (Sequence[str]) –

    The set of tracts to include, by ID.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

in_counties classmethod

in_counties(counties: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US counties/county-equivalents.

Parameters:

  • counties (Sequence[str]) –

    The set of counties to include. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

in_states classmethod

in_states(states: Sequence[str], year: int) -> Self

Create a scope including all nodes in a set of US states/state-equivalents.

Parameters:

  • states (Sequence[str]) –

    The set of states to include. This can be a list of either state names, postal codes, or FIPs codes.

  • year (int) –

    The Census delineation year.

Returns:

  • Self

    The new scope.

Raises:

CensusGrouping dataclass

CensusGrouping(granularity: CensusGranularityName)

Bases: GeoGrouping

A geo-axis grouping for Census geo scopes, for example, "group by state".

Parameters:

granularity instance-attribute

granularity: CensusGranularityName

The granularity to group by.

map

map(node_ids: NDArray[str_]) -> NDArray[str_]

Produce a column that describes the group membership of each node.

The returned column will be used as the basis of a groupby operation.

Parameters:

Returns:

  • NDArray[str_]

    An array of the same length as node_ids where each value defines which group the original node ID belongs to.

StateSelection dataclass

StateSelection(
    scope: GeoScopeT_co,
    selection: NDArray[bool_],
    grouping: GeoGrouping | None,
    aggregation: GeoAggMethod | None,
)

Bases: GeoSelection[CensusScope]

A geo selection on a StateScope.

CountySelection dataclass

CountySelection(
    scope: GeoScopeT_co,
    selection: NDArray[bool_],
    grouping: GeoGrouping | None,
    aggregation: GeoAggMethod | None,
)

Bases: GeoSelection[CensusScope]

A geo selection on a CountyScope.

group

group(
    grouping: Literal["state"] | GeoGrouping,
) -> GeoGroup[CensusScope]

Groups the geo series using the specified grouping.

Parameters:

  • grouping (Literal['state'] | GeoGrouping) –

    The grouping to use. You can specify a supported string value -- all of which act as shortcuts for common GeoGrouping instances -- or you can provide a GeoGrouping instance to perform custom grouping.

    The shortcut values are:

    • "state": equivalent to CensusGrouping("state")

Returns:

TractSelection dataclass

TractSelection(
    scope: GeoScopeT_co,
    selection: NDArray[bool_],
    grouping: GeoGrouping | None,
    aggregation: GeoAggMethod | None,
)

Bases: GeoSelection[CensusScope]

A geo selection on a TractScope.

group

group(
    grouping: Literal["state", "county"] | GeoGrouping,
) -> GeoGroup[CensusScope]

Groups the geo series using the specified grouping.

Parameters:

  • grouping (Literal['state', 'county'] | GeoGrouping) –

    The grouping to use. You can specify a supported string value -- all of which act as shortcuts for common GeoGrouping instances -- or you can provide a GeoGrouping instance to perform custom grouping.

    The shortcut values are:

    • "state": equivalent to CensusGrouping("state")
    • "county": equivalent to CensusGrouping("county")

Returns:

BlockGroupSelection dataclass

BlockGroupSelection(
    scope: GeoScopeT_co,
    selection: NDArray[bool_],
    grouping: GeoGrouping | None,
    aggregation: GeoAggMethod | None,
)

Bases: GeoSelection[CensusScope]

A geo selection on a BlockGroupScope.

group

group(
    grouping: Literal["state", "county", "tract"]
    | GeoGrouping,
) -> GeoGroup[CensusScope]

Groups the geo series using the specified grouping.

Parameters:

  • grouping (Literal['state', 'county', 'tract'] | GeoGrouping) –

    The grouping to use. You can specify a supported string value -- all of which act as shortcuts for common GeoGrouping instances -- or you can provide a GeoGrouping instance to perform custom grouping.

    The shortcut values are:

    • "state": equivalent to CensusGrouping("state")
    • "county": equivalent to CensusGrouping("county")
    • "tract": equivalent to CensusGrouping("tract")

StateSelector dataclass

StateSelector(
    _scope: CensusScopeT,
    _selection_class: type[CensusSelectionT],
)

Bases: _CensusSelector[CensusScopeT, CensusSelectionT]

A geo selector on a StateScope.

Most of the time you obtain one of these using a scope's select property.

by_state

by_state(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of states.

Parameters:

  • *identifiers (str, default: () ) –

    The set of states to include, as var-args. This can be a list of either state names, postal codes, or FIPs codes.

Returns:

by_geoid

by_geoid(*geoids: str) -> CensusSelectionT

Select nodes by GEOID. It is possible to select all nodes within a coarser granularity by passing those GEOIDs, however all GEOIDs given must be the same granularity.

Parameters:

  • *geoids (str, default: () ) –

    The GEOIDs to select, as var-args.

Returns:

by_slice

by_slice(
    start: int,
    stop: int | None = None,
    step: int | None = None,
) -> CensusSelectionT

Select nodes by specifying a slice on the node indices.

Parameters:

  • start (int) –

    The initial index.

  • stop (int | None, default: None ) –

    The stop index (exclusive of the endpoint), or None for no endpoint.

  • step (int | None, default: None ) –

    The interval between selected indices, or None to default to every index.

Returns:

by_indices

by_indices(indices: list[int]) -> CensusSelectionT

Select nodes by specifying the node indices to include.

Parameters:

  • indices (list[int]) –

    The indices to include.

Returns:

CountySelector dataclass

CountySelector(
    _scope: CensusScopeT,
    _selection_class: type[CensusSelectionT],
)

Bases: StateSelector[CensusScopeT, CensusSelectionT]

A geo selector on a CountyScope.

Most of the time you obtain one of these using a scope's select property.

by_county

by_county(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of counties.

Parameters:

  • *identifiers (str, default: () ) –

    The set of counties to include, as var-args. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

Returns:

by_geoid

by_geoid(*geoids: str) -> CensusSelectionT

Select nodes by GEOID. It is possible to select all nodes within a coarser granularity by passing those GEOIDs, however all GEOIDs given must be the same granularity.

Parameters:

  • *geoids (str, default: () ) –

    The GEOIDs to select, as var-args.

Returns:

by_slice

by_slice(
    start: int,
    stop: int | None = None,
    step: int | None = None,
) -> CensusSelectionT

Select nodes by specifying a slice on the node indices.

Parameters:

  • start (int) –

    The initial index.

  • stop (int | None, default: None ) –

    The stop index (exclusive of the endpoint), or None for no endpoint.

  • step (int | None, default: None ) –

    The interval between selected indices, or None to default to every index.

Returns:

by_indices

by_indices(indices: list[int]) -> CensusSelectionT

Select nodes by specifying the node indices to include.

Parameters:

  • indices (list[int]) –

    The indices to include.

Returns:

by_state

by_state(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of states.

Parameters:

  • *identifiers (str, default: () ) –

    The set of states to include, as var-args. This can be a list of either state names, postal codes, or FIPs codes.

Returns:

TractSelector dataclass

TractSelector(
    _scope: CensusScopeT,
    _selection_class: type[CensusSelectionT],
)

Bases: CountySelector[CensusScopeT, CensusSelectionT]

A geo selector on a TractScope.

Most of the time you obtain one of these using a scope's select property.

by_tract

by_tract(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of tracts.

Parameters:

  • *identifiers (str, default: () ) –

    The set of tracts to include by ID, as var-args.

Returns:

by_geoid

by_geoid(*geoids: str) -> CensusSelectionT

Select nodes by GEOID. It is possible to select all nodes within a coarser granularity by passing those GEOIDs, however all GEOIDs given must be the same granularity.

Parameters:

  • *geoids (str, default: () ) –

    The GEOIDs to select, as var-args.

Returns:

by_slice

by_slice(
    start: int,
    stop: int | None = None,
    step: int | None = None,
) -> CensusSelectionT

Select nodes by specifying a slice on the node indices.

Parameters:

  • start (int) –

    The initial index.

  • stop (int | None, default: None ) –

    The stop index (exclusive of the endpoint), or None for no endpoint.

  • step (int | None, default: None ) –

    The interval between selected indices, or None to default to every index.

Returns:

by_indices

by_indices(indices: list[int]) -> CensusSelectionT

Select nodes by specifying the node indices to include.

Parameters:

  • indices (list[int]) –

    The indices to include.

Returns:

by_state

by_state(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of states.

Parameters:

  • *identifiers (str, default: () ) –

    The set of states to include, as var-args. This can be a list of either state names, postal codes, or FIPs codes.

Returns:

by_county

by_county(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of counties.

Parameters:

  • *identifiers (str, default: () ) –

    The set of counties to include, as var-args. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

Returns:

BlockGroupSelector dataclass

BlockGroupSelector(
    _scope: CensusScopeT,
    _selection_class: type[CensusSelectionT],
)

Bases: TractSelector[CensusScopeT, CensusSelectionT]

A geo selector on a BlockGroupScope.

Most of the time you obtain one of these using a scope's select property.

by_block_group

by_block_group(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of block groups.

Parameters:

  • *identifiers (str, default: () ) –

    The set of block groups to include by ID, as var-args.

Returns:

by_geoid

by_geoid(*geoids: str) -> CensusSelectionT

Select nodes by GEOID. It is possible to select all nodes within a coarser granularity by passing those GEOIDs, however all GEOIDs given must be the same granularity.

Parameters:

  • *geoids (str, default: () ) –

    The GEOIDs to select, as var-args.

Returns:

by_slice

by_slice(
    start: int,
    stop: int | None = None,
    step: int | None = None,
) -> CensusSelectionT

Select nodes by specifying a slice on the node indices.

Parameters:

  • start (int) –

    The initial index.

  • stop (int | None, default: None ) –

    The stop index (exclusive of the endpoint), or None for no endpoint.

  • step (int | None, default: None ) –

    The interval between selected indices, or None to default to every index.

Returns:

by_indices

by_indices(indices: list[int]) -> CensusSelectionT

Select nodes by specifying the node indices to include.

Parameters:

  • indices (list[int]) –

    The indices to include.

Returns:

by_state

by_state(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of states.

Parameters:

  • *identifiers (str, default: () ) –

    The set of states to include, as var-args. This can be a list of either state names, postal codes, or FIPs codes.

Returns:

by_county

by_county(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of counties.

Parameters:

  • *identifiers (str, default: () ) –

    The set of counties to include, as var-args. This can be a list of county names (in county-comma-postal-code format, e.g., "Maricopa, AZ") or FIPS codes.

Returns:

by_tract

by_tract(*identifiers: str) -> CensusSelectionT

Select all nodes within a set of tracts.

Parameters:

  • *identifiers (str, default: () ) –

    The set of tracts to include by ID, as var-args.

Returns: