df.with_columns(pl.col.b + pl.row_index().is_between(1, 3)) # shape: (5, 2) # ┌─────┬─────┐ # │ a ┆ b │ # │ --- ┆ --- │ # │ i64 ┆ i64 │ # ╞═════╪═════╡ # │ 1 ┆ 10 │ # │ 2 ┆ 21 │ # │ 3 ┆ 31 │ # │ 4 ┆ 41 │ # │ 5 ┆ 50 │ # └─────┴─────┘
I believe it is just "syntax sugar" for calling `Series.scatter()`[1]
> it doesn't allow slicing
I believe you are correct:
df_polars[1:3, "b"] += 1 # TypeError: cannot use "slice(1, 3, None)" for indexing
df_polars[list(range(1, 4)), "b"] += 1
[1]: https://github.com/pola-rs/polars/blob/9079e20ae59f8c75dcce8...
I believe it is just "syntax sugar" for calling `Series.scatter()`[1]
> it doesn't allow slicing
I believe you are correct:
You can do: Perhaps nobody has requested slice syntax? It seems like it would be easy to add.[1]: https://github.com/pola-rs/polars/blob/9079e20ae59f8c75dcce8...