pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
29.14k stars 1.83k forks source link

`Series.scatter` operates in-place #17332

Open mcrumiller opened 2 months ago

mcrumiller commented 2 months ago

Issue description

Series.scatter operates in-place, but it is not documented to do so. This perhaps should be a documentation update, but I am not sure what the intended behavior is.

import polars as pl

s = pl.Series([1, 2, 3, 4, 5])
s.scatter(0, 99)
print(s)
# shape: (5,)
# Series: '' [i64]
# [
#         99
#         2
#         3
#         4
#         5
# ]

Installed versions

main

mcrumiller commented 2 months ago

FYI I think that the usage of scatter, as in the case I was using it for, is to manually update a few of the items, in which case I feel that it should operate in-place. So I think that only a documentation update is warranted, but what do you think @stinodego?