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

Expr.replace and Expr.replace_strict set "NO_DEFAULT" as a value #18185

Closed
2 tasks done
henryharbeck opened this issue Aug 14, 2024 · 1 comment · Fixed by #18492
Closed
2 tasks done

Expr.replace and Expr.replace_strict set "NO_DEFAULT" as a value #18185

henryharbeck opened this issue Aug 14, 2024 · 1 comment · Fixed by #18492
Labels
A-ops Area: operations bug Something isn't working P-low Priority: low python Related to Python Polars

Comments

@henryharbeck
Copy link
Contributor

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

df = pl.DataFrame({"a": ["a", "b", "c"]})
df.select(pl.col("a").replace("b"))
# shape: (3, 1)
# ┌────────────┐
# │ a          │
# │ ---        │
# │ str        │
# ╞════════════╡
# │ a          │
# │ NO_DEFAULT │
# │ c          │
# └────────────┘


df_2 = pl.DataFrame({"a": ["b", "b", "b"]})
df_2.select(pl.col("a").replace_strict("b"))
# shape: (3, 1)
# ┌────────────┐
# │ a          │
# │ ---        │
# │ str        │
# ╞════════════╡
# │ NO_DEFAULT │
# │ NO_DEFAULT │
# │ NO_DEFAULT │
# └────────────┘

Log output

No response

Issue description

NO_DEFAULT should not be set as a string value

Expected behavior

Raise that new must be specified unless old is a mapping

Installed versions

main branch

@henryharbeck henryharbeck added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Aug 14, 2024
@henryharbeck henryharbeck changed the title Expr.replace and Expr.replace_strict set "NO_DEFAULT" as a value Expr.replace and Expr.replace_strict set "NO_DEFAULT" as a value Aug 14, 2024
@henryharbeck
Copy link
Contributor Author

I am keen to pick this up, as I noticed this while working on a PR for #17220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ops Area: operations bug Something isn't working P-low Priority: low python Related to Python Polars
Projects
Archived in project
2 participants