Select column as Series at index location
Description
Select column as Series at index location
Usage
<DataFrame>$to_series(index = 0)
Arguments
index
|
Index of the column to return as Series. Defaults to 0, which is the first column. |
Value
Series or NULL
Examples
library("polars")
df <- as_polars_df(iris[1:10, ])
# default is to extract the first column
df$to_series()
#> shape: (10, 1)
#> ┌──────────────┐
#> │ Sepal.Length │
#> │ --- │
#> │ f64 │
#> ╞══════════════╡
#> │ 5.1 │
#> │ 4.9 │
#> │ 4.7 │
#> │ 4.6 │
#> │ 5.0 │
#> │ 5.4 │
#> │ 4.6 │
#> │ 5.0 │
#> │ 4.4 │
#> │ 4.9 │
#> └──────────────┘
#> shape: (10, 1)
#> ┌─────────────┐
#> │ Sepal.Width │
#> │ --- │
#> │ f64 │
#> ╞═════════════╡
#> │ 3.5 │
#> │ 3.0 │
#> │ 3.2 │
#> │ 3.1 │
#> │ 3.6 │
#> │ 3.9 │
#> │ 3.4 │
#> │ 3.4 │
#> │ 2.9 │
#> │ 3.1 │
#> └─────────────┘