Remove columns
Description
Remove columns
Usage
<DataFrame>$drop(..., strict = TRUE)
Arguments
…
|
\<dynamic-dots \> Names of the columns that should be
removed. Accepts column selector input.
|
strict
|
Validate that all column names exist in the current schema, and throw an exception if any do not. |
Value
A polars DataFrame
Examples
library("polars")
# Drop columns by passing the name of those columns
df <- pl$DataFrame(
foo = 1:3,
bar = c(6, 7, 8),
ham = c("a", "b", "c")
)
df$drop("ham")
#> shape: (3, 2)
#> ┌─────┬─────┐
#> │ foo ┆ bar │
#> │ --- ┆ --- │
#> │ i32 ┆ f64 │
#> ╞═════╪═════╡
#> │ 1 ┆ 6.0 │
#> │ 2 ┆ 7.0 │
#> │ 3 ┆ 8.0 │
#> └─────┴─────┘
#> shape: (3, 1)
#> ┌─────┐
#> │ foo │
#> │ --- │
#> │ i32 │
#> ╞═════╡
#> │ 1 │
#> │ 2 │
#> │ 3 │
#> └─────┘
#> shape: (0, 0)
#> ┌┐
#> ╞╡
#> └┘