DataFrameComparison.right_only#

DataFrameComparison.right_only(
*,
lazy: Literal[True],
) LazyFrame[source]#
DataFrameComparison.right_only(
*,
lazy: Literal[False] = False,
) DataFrame

The rows in the right data frame which cannot be joined with a row in the left data frame.

Parameters:

lazy – If True, return a lazy frame. Otherwise, return an eager frame (default).

Returns:

A data frame or lazy frame containing the rows that are only in the right data frame.

Examples

>>> import polars as pl
>>> from diffly import compare_frames
>>> left = pl.DataFrame({"id": [1, 2, 3, 4], "value": [10.0, 20.0, 30.0, 40.0]})
>>> right = pl.DataFrame({"id": [1, 2, 3, 5], "value": [10.0, 25.0, 30.0, 50.0]})
>>> comparison = compare_frames(left, right, primary_key="id")
>>> comparison.right_only()
shape: (1, 2)
┌─────┬───────┐
│ id  ┆ value │
│ --- ┆ ---   │
│ i64 ┆ f64   │
╞═════╪═══════╡
│ 5   ┆ 50.0  │
└─────┴───────┘