pola-rs/r-polars

`$len()` doesn't count `null` but it should

Closed this issue · 0 comments

import polars as pl
pl.DataFrame({"x": [1, 2, None]}).with_columns(y=pl.col("x").len())

shape: (3, 2)
┌──────┬─────┐
│ xy   │
│ ------ │
│ i64u32 │
╞══════╪═════╡
│ 13   │
│ 23   │
│ null3   │
└──────┴─────┘
library(polars)
pl$DataFrame(x = c(1, 2, NA))$with_columns(y = pl$col("x")$len())

shape: (3, 2)
┌──────┬─────┐
│ xy   │
│ ------ │
│ f64u32 │
╞══════╪═════╡
│ 1.02   │
│ 2.02   │
│ null2   │
└──────┴─────┘