Skip to content

Commit a13439a

Browse files
authored
COMPAT: compatibility with pandas 3 (#283)
* COMPAT: compatibility with pandas 3 * safety
1 parent ac48821 commit a13439a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

neatnet/artifacts.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ def get_artifacts(
352352
polys["isoareal_index"] = shape.isoareal_quotient(polys.geometry)
353353
polys["isoperimetric_quotient"] = shape.isoperimetric_quotient(polys.geometry)
354354

355-
is_artifact = polys["is_artifact"]
356355
area = polys["area_sqm"]
357356
isoareal = polys["isoareal_index"]
358357
isoperimetric = polys["isoperimetric_quotient"]
@@ -365,7 +364,7 @@ def _all_any(group):
365364
while True:
366365
# count number of artifacts to break while loop
367366
# when no new artifacts are added
368-
artifact_count_before = sum(is_artifact)
367+
artifact_count_before = sum(polys["is_artifact"])
369368

370369
# polygons that are enclosed by artifacts (at this moment) and
371370
# that are touching artifacts (at this moment)
@@ -397,11 +396,11 @@ def _all_any(group):
397396
cond_metric = isoperimetric > isoperimetric_threshold_circles_touching
398397
polys.loc[cond_geom & cond_area & cond_metric, "is_artifact"] = True
399398

400-
artifact_count_after = sum(is_artifact)
399+
artifact_count_after = sum(polys["is_artifact"])
401400
if artifact_count_after == artifact_count_before:
402401
break
403402

404-
artifacts = polys[is_artifact][["geometry"]].reset_index(drop=True)
403+
artifacts = polys[polys["is_artifact"]][["geometry"]].reset_index(drop=True)
405404
artifacts["id"] = artifacts.index
406405

407406
if exclusion_mask is not None:

0 commit comments

Comments
 (0)