Polars Expressions
Description
Expressions are all the functions and methods that are applicable to a Polars DataFrame or LazyFrame object. Some methods are under the sub-namespaces.
Sub-namespaces
arr
$arr
stores all array related
methods.
bin
$bin
stores all binary related
methods.
cat
$cat
stores all categorical
related methods.
dt
$dt
stores all temporal related
methods.
list
$list
stores all list related
methods.
meta
$meta
stores all methods for
working with the meta data.
name
$name
stores all name related
methods.
str
$str
stores all string related
methods.
struct
$struct
stores all struct related
methods.
Examples
library("polars")
df = pl$DataFrame(
a = 1:2,
b = list(1:2, 3:4),
schema = list(a = pl$Int64, b = pl$Array(pl$Int64, 2))
)
df$select(pl$col("a")$first())
#> shape: (1, 1)
#> ┌─────┐
#> │ a │
#> │ --- │
#> │ i64 │
#> ╞═════╡
#> │ 1 │
#> └─────┘
#> shape: (2, 1)
#> ┌─────┐
#> │ b │
#> │ --- │
#> │ i64 │
#> ╞═════╡
#> │ 3 │
#> │ 7 │
#> └─────┘