Skip to content

cluster_size

Compute the size of a GeoDataFrame cluster.

Parameters:

Name Type Description Default
gdf GeoDataFrame

The GeoDataFrame containing the cluster data.

required

Returns:

Name Type Description
float float

The size of the cluster.

Source code in src/histolytics/spatial_clust/clust_metrics.py
def cluster_size(gdf: gpd.GeoDataFrame) -> float:
    """Compute the size of a GeoDataFrame cluster.

    Parameters:
        gdf (gpd.GeoDataFrame):
            The GeoDataFrame containing the cluster data.

    Returns:
        float: The size of the cluster.
    """
    return len(gdf)