Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataFrame.__pow__ fails for (series, column) inputs #17787

Open
mcrumiller opened this issue Jul 22, 2024 · 1 comment
Open

DataFrame.__pow__ fails for (series, column) inputs #17787

mcrumiller opened this issue Jul 22, 2024 · 1 comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@mcrumiller
Copy link
Contributor

mcrumiller commented Jul 22, 2024

Issue Description

When pow() is used in a select, if the first argument is an external Series and the second is a column, an invalid ColumnNotFoundError is raised.

Noticed as a result of looking into #17760.

import polars as pl

df = pl.DataFrame({"a": [1, 1, 2]})
s = pl.Series("b", [1, 1, 1])
df.select(s ** pl.col("a"))
polars.exceptions.ColumnNotFoundError: a

Installed versions

main

@mcrumiller mcrumiller added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Jul 22, 2024
@mcrumiller
Copy link
Contributor Author

The real error is in Series * expr failing if expr is a column:

pl.Series() * pl.col("a")   # <Expr ['[(Series) * (col("a"))]'] at 0x7F19A0B5CE60>
pl.Series() ** pl.col("a")  # polars.exceptions.ColumnNotFoundError: a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

1 participant