Skip to content

Commit

Permalink
Allow fill_null to be used with torch tensors
Browse files Browse the repository at this point in the history
  • Loading branch information
Niko committed Oct 7, 2024
1 parent addaf83 commit 28e7fc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions py-polars/polars/functions/lit.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def lit(
if dtype:
return wrap_expr(plr.lit(value, allow_object, is_scalar=True)).cast(dtype)

try:
if isinstance(value, np.generic):
# numpy literals like np.float32(0) have item/dtype
item = value.item()

Expand All @@ -176,7 +176,7 @@ def lit(
time_unit = dtype_name[len("timedelta64[") : -1]
return lit(item).cast(Duration(time_unit))

except AttributeError:
else:
item = value

return wrap_expr(plr.lit(item, allow_object, is_scalar=True))

0 comments on commit 28e7fc7

Please sign in to comment.