Skip to content

Get the DataFrame as a list of Series

Description

Get the DataFrame as a list of Series

Usage

<DataFrame>$get_columns()

Value

A list of Series

See Also

  • as.list(\)

Examples

library("polars")

df <- pl$DataFrame(foo = c(1, 2, 3), bar = c(4, 5, 6))
df$get_columns()
#> $foo
#> shape: (3,)
#> Series: 'foo' [f64]
#> [
#>  1.0
#>  2.0
#>  3.0
#> ]
#> 
#> $bar
#> shape: (3,)
#> Series: 'bar' [f64]
#> [
#>  4.0
#>  5.0
#>  6.0
#> ]
df <- pl$DataFrame(
  a = 1:4,
  b = c(0.5, 4, 10, 13),
  c = c(TRUE, TRUE, FALSE, TRUE)
)
df$get_columns()
#> $a
#> shape: (4,)
#> Series: 'a' [i32]
#> [
#>  1
#>  2
#>  3
#>  4
#> ]
#> 
#> $b
#> shape: (4,)
#> Series: 'b' [f64]
#> [
#>  0.5
#>  4.0
#>  10.0
#>  13.0
#> ]
#> 
#> $c
#> shape: (4,)
#> Series: 'c' [bool]
#> [
#>  true
#>  true
#>  false
#>  true
#> ]