`$len()` doesn't count `null` but it should
Closed this issue · 0 comments
etiennebacher commented
import polars as pl
pl.DataFrame({"x": [1, 2, None]}).with_columns(y=pl.col("x").len())
shape: (3, 2)
┌──────┬─────┐
│ x ┆ y │
│ --- ┆ --- │
│ i64 ┆ u32 │
╞══════╪═════╡
│ 1 ┆ 3 │
│ 2 ┆ 3 │
│ null ┆ 3 │
└──────┴─────┘
library(polars)
pl$DataFrame(x = c(1, 2, NA))$with_columns(y = pl$col("x")$len())
shape: (3, 2)
┌──────┬─────┐
│ x ┆ y │
│ --- ┆ --- │
│ f64 ┆ u32 │
╞══════╪═════╡
│ 1.0 ┆ 2 │
│ 2.0 ┆ 2 │
│ null ┆ 2 │
└──────┴─────┘