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

.shift() inside .replace() PanicException #20334

Open
2 tasks done
cmdlineluser opened this issue Dec 17, 2024 · 0 comments
Open
2 tasks done

.shift() inside .replace() PanicException #20334

cmdlineluser opened this issue Dec 17, 2024 · 0 comments
Labels
A-panic Area: code that results in panic exceptions bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@cmdlineluser
Copy link
Contributor

cmdlineluser commented Dec 17, 2024

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl

df = pl.DataFrame({"x": [1, 2, 3]})

df.select(
    pl.lit(None).replace(None, pl.col("x").shift())
)

# thread '<unnamed>' panicked at crates/polars-core/src/series/iterator.rs:88:9:
# assertion `left == right` failed: impl error
#  left: 2
# right: 1

Log output

No response

Issue description

I was just experimenting with syntax, there was no real use case.

It seems to be specific to pl.lit(None)

With pl.lit(1) it gives the appropriate error instead.

# InvalidOperationError: `new` input for `replace` must have the same length as `old` or have length 1

Expected behavior

Error instead of panic.

Installed versions

main

@cmdlineluser cmdlineluser added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Dec 17, 2024
@cmdlineluser cmdlineluser changed the title pl.when inside .replace() PanicException .shift() inside .replace() PanicException Dec 17, 2024
@alexander-beedie alexander-beedie added the A-panic Area: code that results in panic exceptions label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-panic Area: code that results in panic exceptions 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

2 participants