Skip to content

Commit

Permalink
add type coercion as extra safeguard
Browse files Browse the repository at this point in the history
  • Loading branch information
atmorling committed Nov 20, 2024
1 parent 288ed3d commit 5d167a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ecoscope/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ def remove_filtered(self, inplace=False):
else:
frame = self.copy()

if not frame["junk_status"].dtype == bool:
warnings.warn(
f"junk_status column is of type {frame['junk_status'].dtype}, expected `bool`. "
"Attempting to automatically convert."
)
frame["junk_status"] = frame["junk_status"].astype(bool)

frame.query("~junk_status", inplace=True)

if not inplace:
Expand Down

0 comments on commit 5d167a7

Please sign in to comment.