def METHOD_NAME(data: pd.DataFrame) -> pd.DataFrame:
    """Builds report containing counts of locations with values.
    Args:
        data: Dataset to summarize.
    Returns:
    """
    if "population" not in data.columns:
        pop = fips_population.FIPSPopulation.make_dataset()
        pop_map = pop.static.set_index("fips")["population"]
        data["population"] = data["fips"].map(pop_map)
    def classify_row(row):
        if row.aggregate_level == "state":
            return "state data"
        return row.state
    def count_with_values(x):
        return x.apply(lambda y: sum(~y.isna()))
    data[LOCATION_GROUP_KEY] = data.apply(classify_row, axis=1)
    counts_per_location = data.groupby(LOCATION_GROUP_KEY).apply(count_with_values)
    columns_to_drop = [
        CommonFields.STATE,
        CommonFields.COUNTY,
        CommonFields.AGGREGATE_LEVEL,
    ]
    columns_to_drop = counts_per_location.columns.intersection(columns_to_drop)
    counts_per_location = counts_per_location.drop(columns_to_drop, axis="columns")
    counts_per_location["total_population"] = data.groupby(LOCATION_GROUP_KEY).population.sum()
    counts_per_location = counts_per_location.sort_values("total_population", ascending=False).drop(
        ["total_population"], axis="columns"
    )
    return counts_per_location.rename({LOCATION_GROUP_KEY: "num_locations"}, axis="columns")