Skip to content

Create an empty or n-row null-filled copy of the Series

Source code

Description

Returns a n-row null-filled Series with an identical schema. n can be greater than the current number of values in the Series.

Usage

<Series>$clear(n = 0)

Arguments

n Number of (null-filled) rows to return in the cleared frame.

Value

A n-value null-filled Series with an identical schema

Examples

library("polars")

s = pl$Series(name = "a", values = 1:3)

s$clear()
#> polars Series: shape: (0,)
#> Series: 'a' [i32]
#> [
#> ]
s$clear(n = 5)
#> polars Series: shape: (5,)
#> Series: 'a' [i32]
#> [
#>  null
#>  null
#>  null
#>  null
#>  null
#> ]