Skip to content

Commit

Permalink
Fix bug caught in review.
Browse files Browse the repository at this point in the history
  • Loading branch information
pythonspeed committed Jul 15, 2024
1 parent a409826 commit 1bac4d3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions py-polars/polars/expr/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,15 @@ def __array_ufunc__(
# np.divide(pl.col("a"), pl.col("a")); we'll be creating a struct
# below, and structs can't have duplicate names.
first_renamable_expr = True
new_exprs = []
actual_exprs = []
for inp, is_actual_expr, index in exprs:
if is_actual_expr:
if first_renamable_expr:
first_renamable_expr = False
else:
inp = inp.alias(f"argument_{index}")
new_exprs.append((inp, is_actual_expr, index))
exprs = new_exprs
root_expr = F.struct(expr[0] for expr in exprs if is_actual_expr)
actual_exprs.append(inp)
root_expr = F.struct(actual_exprs)

def function(s: Series) -> Series: # pragma: no cover
args = []
Expand Down

0 comments on commit 1bac4d3

Please sign in to comment.