You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This seems correct to me because and needs a boolean result and true | into-df returns a NuDataFrame which is not a boolean. it's similar to doing 1 and 3, which also produces an error, since 1 and 3 are not bools.
This seems correct to me because and needs a boolean result and true | into-df returns a NuDataFrame which is not a boolean. it's similar to doing 1 and 3, which also produces an error, since 1 and 3 are not bools.
How should I interpret the error messages from the following two commands? In test 1 the error suggests the left hand argument is a "NuDataFrame", while the second suggests a "Series of type bool". Am I missing something?
# running
(true | polars into-df) ==0# returnsError: × Incorrect type
╭─[entry #25:1:9]1 │ (true | polars into-df) ==0
· ───────┬──────
· ╰── Series of type bool can not be used for operations with an i64 value
╰────
I still have the impression something is not working correctly. Test 1 and 2 work as expected, but combing masks with the logical operator fails. The documentation (linked in initial comment) suggests it should work.
# basic setuplet df = [{a: 1},{a: 2},{a: 3}] | polars into-df
# test 1$df| polars set (-1) --mask ($df>1)
╭───┬────╮
│ # │ a │
├───┼────┤
│ 0 │ 1 │
│ 1 │ -1 │
│ 2 │ -1 │
╰───┴────╯
# test 2$df| polars set (-1) --mask ($df<3)
╭───┬────╮
│ # │ a │
├───┼────┤
│ 0 │ -1 │
│ 1 │ -1 │
│ 2 │ 3 │
╰───┴────╯
# test 3$df| polars set (-1) --mask (($df>1) and ($df<3))
Error: nu::shell::type_mismatch
× Type mismatch.
╭─[entry #11:1:32]1 │ $df| polars set (-1) --mask (($df>1) and ($df<3))
· ───┬───
· ╰── expected bool
╰────
polars set (-1) --mask (($df>1) and ($df<3))
I'll have to dig into this a bit.. I am not as familiar with the workings of polars set.. It does look like the code has a lot of explicit checks for boolean types.
I'll have to dig into this a bit.. I am not as familiar with the workings of polars set.. It does look like the code has a lot of explicit checks for boolean types.
I have the impression the error stems from boolean operations of polars series.. the error is throw if you just try and run:
Activity
fdncred commentedon Dec 5, 2024
This seems correct to me because
andneeds a boolean result andtrue | into-dfreturns a NuDataFrame which is not a boolean. it's similar to doing1 and 3, which also produces an error, since 1 and 3 are not bools.tino376dev commentedon Dec 6, 2024
How should I interpret the error messages from the following two commands? In test 1 the error suggests the left hand argument is a "NuDataFrame", while the second suggests a "Series of type bool". Am I missing something?
test 1
test 2
fdncred commentedon Dec 6, 2024
So, test1 is correct. test2 may be reporting the wrong error.
tino376dev commentedon Dec 6, 2024
I still have the impression something is not working correctly. Test 1 and 2 work as expected, but combing masks with the logical operator fails. The documentation (linked in initial comment) suggests it should work.
fdncred commentedon Dec 6, 2024
@ayax79 any ideas here?
ayax79 commentedon Dec 7, 2024
I'll have to dig into this a bit.. I am not as familiar with the workings of
polars set.. It does look like the code has a lot of explicit checks for boolean types.tino376dev commentedon Dec 7, 2024
I have the impression the error stems from boolean operations of polars series.. the error is throw if you just try and run:
ayax79 commentedon Dec 9, 2024
More investigation. For some reason I don't think the plugin is being called when Operator::Booean(Boolean::And) operations happen.
ayax79 commentedon Dec 9, 2024
In 0.98 with the new IR feature disabled, the following works.. note that the column needs to be called out directly.
I'll connect with @devyn some more.. It looks like none of the custom value add stuff is getting called when using IR.
Change how `and` and `or` operations are compiled to IR to support cu…
devyn commentedon Dec 21, 2024
I think I've found a fix for this. Thanks for reporting!
New IR:
Change how `and` and `or` operations are compiled to IR to support cu…