Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
verbose : bool (default True)
if True, shows progress bars in loops and indication of steps
Returns
-------
GeoDataFrame
GeoDataFrame containing preprocessed geometry
"""
blg = buildings.copy()
blg = blg.explode()
blg.reset_index(drop=True, inplace=True)
for loop in range(0, loops):
print("Loop", loop + 1, f"out of {loops}.") if verbose else None
blg.reset_index(inplace=True, drop=True)
blg["mm_uid"] = range(len(blg))
sw = libpysal.weights.contiguity.Rook.from_dataframe(blg, silence_warnings=True)
blg["neighbors"] = sw.neighbors
blg["neighbors"] = blg["neighbors"].map(sw.neighbors)
blg["n_count"] = blg.apply(lambda row: len(row.neighbors), axis=1)
blg["circu"] = CircularCompactness(blg).series
# idetify those smaller than x with only one neighbor and attaches it to it.
join = {}
delete = []
for row in tqdm(
blg.itertuples(),
total=blg.shape[0],
desc="Identifying changes",
disable=not verbose,
):
if size: