Drop duplicate rows
Description
Drop duplicate rows
Usage
<LazyFrame>$unique(
...,
keep = c("any", "none", "first", "last"),
maintain_order = FALSE,
subset = deprecated()
)
Arguments
Value
A polars LazyFrame
Examples
library("polars")
lf <- pl$LazyFrame(
foo = c(1, 2, 3, 1),
bar = c("a", "a", "a", "a"),
ham = c("b", "b", "b", "b"),
)
lf$unique(maintain_order = TRUE)$collect()
#> shape: (3, 3)
#> ┌─────┬─────┬─────┐
#> │ foo ┆ bar ┆ ham │
#> │ --- ┆ --- ┆ --- │
#> │ f64 ┆ str ┆ str │
#> ╞═════╪═════╪═════╡
#> │ 1.0 ┆ a ┆ b │
#> │ 2.0 ┆ a ┆ b │
#> │ 3.0 ┆ a ┆ b │
#> └─────┴─────┴─────┘
#> shape: (1, 3)
#> ┌─────┬─────┬─────┐
#> │ foo ┆ bar ┆ ham │
#> │ --- ┆ --- ┆ --- │
#> │ f64 ┆ str ┆ str │
#> ╞═════╪═════╪═════╡
#> │ 1.0 ┆ a ┆ b │
#> └─────┴─────┴─────┘
#> shape: (3, 3)
#> ┌─────┬─────┬─────┐
#> │ foo ┆ bar ┆ ham │
#> │ --- ┆ --- ┆ --- │
#> │ f64 ┆ str ┆ str │
#> ╞═════╪═════╪═════╡
#> │ 2.0 ┆ a ┆ b │
#> │ 3.0 ┆ a ┆ b │
#> │ 1.0 ┆ a ┆ b │
#> └─────┴─────┴─────┘