polars join-where
for lazyframe
Joins a lazy frame with other lazy frame based on conditions.
This command requires a plugin
The polars join-where
command resides in the polars
plugin. To use this command, you must install and register nu_plugin_polars
. See the Plugins chapter in the book for more information.
Signature
> polars join-where {flags} (other) (condition)
Parameters
other
: LazyFrame to join withcondition
: Condition
Input/output types:
input | output |
---|---|
any | any |
Examples
Join two lazy dataframes with a condition
> let df_a = ([[name cash];[Alice 5] [Bob 10]] | polars into-lazy)
let df_b = ([[item price];[A 3] [B 7] [C 12]] | polars into-lazy)
$df_a | polars join-where $df_b ((polars col cash) > (polars col price)) | polars collect
╭───┬───────┬──────┬──────┬───────╮
│ # │ name │ cash │ item │ price │
├───┼───────┼──────┼──────┼───────┤
│ 0 │ Bob │ 10 │ B │ 7 │
│ 1 │ Bob │ 10 │ A │ 3 │
│ 2 │ Alice │ 5 │ A │ 3 │
╰───┴───────┴──────┴──────┴───────╯