-
-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentation
Description
The .replaceStrict requires passing the default_ to what should be used as default value, even though the docs and the types doesn't mark it as required and states "Defaults to keeping the original value."
const df = pl.DataFrame({
a: [1, 2, 3],
})
const t1 = df.select(pl.col("a").replaceStrict({ old: { 1: 2 } }))
// error: incomplete mapping specified for `replace_strict`
// Hint: Pass a `default` value to set unmapped values.
const t2 = df.select(pl.col("a").replaceStrict({ old: { 1: 2 }, default_: pl.col("a") }))
// shape: (3, 1)
// ┌─────┐
// │ a │
// │ --- │
// │ f64 │
// ╞═════╡
// │ 2.0 │
// │ 2.0 │
// │ 3.0 │
// └─────┘
const t3 = df.select(pl.col("a").replaceStrict(1, 2))
//error: incomplete mapping specified for `replace_strict`
// Hint: Pass a `default` value to set unmapped values.
const t4 = df.select(pl.col("a").replaceStrict(1, 2, pl.col("a")))
// shape: (3, 1)
// ┌─────┐
// │ a │
// │ --- │
// │ f64 │
// ╞═════╡
// │ 2.0 │
// │ 2.0 │
// │ 3.0 │
// └─────┘Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingdocumentationImprovements or additions to documentationImprovements or additions to documentation