Skip to content

Commit

Permalink
MAINT: Adapt to NumPy weak-promotion in comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
seberg committed May 31, 2024
1 parent 314d047 commit d1c7224
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/cudf/cudf/core/column/numerical.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,9 @@ def can_cast_safely(self, to_dtype: DtypeObj) -> bool:
min_, max_ = iinfo.min, iinfo.max

# best we can do is hope to catch it here and avoid compare
if (self.min() >= min_) and (self.max() <= max_):
# Use Python floats, which have precise comparison for float64.
# NOTE(seberg): it would make sense to limit to the mantissa range.
if (float(self.min()) >= min_) and (float(self.max()) <= max_):
filled = self.fillna(0)
return (cudf.Series(filled) % 1 == 0).all()
else:
Expand Down

0 comments on commit d1c7224

Please sign in to comment.