W3cubDocs

/Nushell

dfr join for lazyframe

Joins a lazy frame with other lazy frame.

Signature

> dfr join {flags} (other) (left_on) (right_on)

Flags

  • --inner, -i: inner joing between lazyframes (default)
  • --left, -l: left join between lazyframes
  • --outer, -o: outer join between lazyframes
  • --cross, -c: cross join between lazyframes
  • --suffix, -s {string}: Suffix to use on columns with same name

Parameters

  • other: LazyFrame to join with
  • left_on: Left column(s) to join on
  • right_on: Right column(s) to join on

Input/output types:

input output
any any

Examples

Join two lazy dataframes

>letdf_a= ([[abc];[1"a"0] [2"b"1] [1"c"2] [1"c"3]] |dfr into-lazy);
letdf_b= ([["foo""bar""ham"];[1"a""let"] [2"c""var"] [3"c""const"]] |dfr into-lazy);
$df_a|dfr join$df_bafoo|dfr collect
╭───┬───┬───┬───┬─────┬─────╮
# │ a │ b │ c │ bar │ ham │
├───┼───┼───┼───┼─────┼─────┤
01a0alet
12b1cvar
21c2alet
31c3alet
╰───┴───┴───┴───┴─────┴─────╯

Join one eager dataframe with a lazy dataframe

>letdf_a= ([[abc];[1"a"0] [2"b"1] [1"c"2] [1"c"3]] |dfr into-df);
letdf_b= ([["foo""bar""ham"];[1"a""let"] [2"c""var"] [3"c""const"]] |dfr into-lazy);
$df_a|dfr join$df_bafoo
╭───┬───┬───┬───┬─────┬─────╮
# │ a │ b │ c │ bar │ ham │
├───┼───┼───┼───┼─────┼─────┤
01a0alet
12b1cvar
21c2alet
31c3alet
╰───┴───┴───┴───┴─────┴─────╯

Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_join.html