mirror of
https://github.com/nushell/nushell.git
synced 2025-03-13 15:08:43 +01:00
adds And and Or operators to polars plugin nu_expressions (#15248)
solution for #15242 adds "And" ``` ~/Projects/nushell> [[a, b]; [1., 2.], [3.,3.], [4., 6.]] | polars into-df | polars filter (((polars col a) > 2) and ((polars col b) < 5)) ╭───┬──────┬──────╮ │ # │ a │ b │ ├───┼──────┼──────┤ │ 0 │ 3.00 │ 3.00 │ ╰───┴──────┴──────╯ ``` adds "Or" ``` ~/Projects/nushell> [[a, b]; [1., 2.], [3.,3.], [4., 6.]] | polars into-df | polars filter (((polars col a) > 7) or ((polars col b) > 5)) ╭───┬──────┬──────╮ │ # │ a │ b │ ├───┼──────┼──────┤ │ 0 │ 4.00 │ 6.00 │ ╰───┴──────┴──────╯ ``` but not (yet) xor because polars doesn't have a direct expression for logical_xor ``` ~/Projects/nushell> [[a, b]; [1., 2.], [3.,3.], [4., 6.]] | polars into-df | polars filter (((polars col a) > 7) xor ((polars col b) > 5)) Error: nu:🐚:operator_unsupported_type × The 'xor' operator does not work on values of type 'NuExpression'. ╭─[entry #5:1:94] 1 │ [[a, b]; [1., 2.], [3.,3.], [4., 6.]] | polars into-df | polars filter (((polars col a) > 7) xor ((polars col b) > 5)) · ─┬─┬ · │ ╰── NuExpression · ╰── does not support 'NuExpression' ╰──── ``` Co-authored-by: Jack Wright <56345+ayax79@users.noreply.github.com>
This commit is contained in:
parent
88bbe4abaa
commit
551fecd10d