Skip to content

Cast this Series to a DataFrame

Description

Cast this Series to a DataFrame

Usage

<series>$_to_frame(name = NULL)

Arguments

name A character or NULL. If not NULL, name/rename the Series column in the new DataFrame. If NULL, the column name is taken from the Series name.

Value

A polars DataFrame

See Also

  • as_polars_df()

Examples

library("polars")

s <- pl$Series("a", c(123, 456))
df <- s$to_frame()
df
#> shape: (2, 1)
#> ┌───────┐
#> │ a     │
#> │ ---   │
#> │ f64   │
#> ╞═══════╡
#> │ 123.0 │
#> │ 456.0 │
#> └───────┘
df <- s$to_frame("xyz")
df
#> shape: (2, 1)
#> ┌───────┐
#> │ xyz   │
#> │ ---   │
#> │ f64   │
#> ╞═══════╡
#> │ 123.0 │
#> │ 456.0 │
#> └───────┘