polars.Series.to_frame

Series.to_frame() polars.internals.frame.DataFrame

Cast this Series to a DataFrame.

Examples

>>> s = pl.Series("a", [1, 2, 3])
>>> df = s.to_frame()
>>> df
shape: (3, 1)
┌─────┐
│ a   │
│ --- │
│ i64 │
╞═════╡
│ 1   │
├╌╌╌╌╌┤
│ 2   │
├╌╌╌╌╌┤
│ 3   │
└─────┘
>>> type(df)
<class 'polars.internals.frame.DataFrame'>