withFullJoinOn method

DataFrame withFullJoinOn(
  1. DataFrame that, {
  2. required String pivot,
  3. String? thatPivot,
})

A new data frame representing a full join on that.

Example:

final left = petals.withColumns(["id", "petal_length"]),
  right = sepals.withColumns(["id", "sepal_length"]);
print("Left: $left");
print("Right: $right");
print("Full Join:");
print(left.withFullJoinOn(right, pivot: "id"));
Left:
.---.------------.
|id |petal_length|
:---+------------:
|1  |1.4         |
|2  |1.4         |
|3  |1.3         |
|4  |1.5         |
|51 |4.7         |
|52 |4.5         |
|53 |4.9         |
|54 |4.0         |
|101|6.0         |
|102|5.1         |
|103|5.9         |
|104|5.6         |
'---'------------'

Right:
.---.------------.
|id |sepal_length|
:---+------------:
|3  |4.7         |
|4  |4.6         |
|5  |5.0         |
|6  |5.4         |
|53 |6.9         |
|54 |5.5         |
|55 |6.5         |
|56 |5.7         |
|103|7.1         |
|104|6.3         |
|105|6.5         |
|106|7.6         |
'---'------------'

Full Join:

.---.------------.--------.------------.
|id |petal_length|right_id|sepal_length|
:---+------------+--------+------------:
|1  |1.4         |NaN     |NaN         |
|2  |1.4         |NaN     |NaN         |
|3  |1.3         |3       |4.7         |
|4  |1.5         |4       |4.6         |
|51 |4.7         |NaN     |NaN         |
|52 |4.5         |NaN     |NaN         |
|53 |4.9         |53      |6.9         |
|54 |4.0         |54      |5.5         |
|101|6.0         |NaN     |NaN         |
|102|5.1         |NaN     |NaN         |
|103|5.9         |103     |7.1         |
|104|5.6         |104     |6.3         |
|NaN|NaN         |5       |5.0         |
|NaN|NaN         |6       |5.4         |
|NaN|NaN         |55      |6.5         |
|NaN|NaN         |56      |5.7         |
|NaN|NaN         |105     |6.5         |
|NaN|NaN         |106     |7.6         |
'---'------------'--------'------------'

Implementation

DataFrame withFullJoinOn(
  DataFrame that, {
  required String pivot,
  String? thatPivot,
}) {
  thatPivot = thatPivot ?? pivot;
  final a = categoricColumns.containsKey(pivot)
          ? {...categoricColumns[pivot]!.values}
          : {...numericColumns[pivot]!.values},
      b = that.categoricColumns.containsKey(pivot)
          ? {...that.categoricColumns[pivot]!.values}
          : {...that.numericColumns[pivot]!.values},
      ids = a.union(b);

  return _join(this, that, pivot, thatPivot, ids);
}