[BUG] Using `.iloc[]` to set a single value in a Series does not do so in-place
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
```python
>>> import cudf
>>> s = cudf.Series([1, 2, 3])
>>> s2 = s.iloc[:] # s2 is a view into s
>>> s.iloc[0] = -1 # this line does not behave as expected
>>> s
0 -1
1 2
2 3
dtype: int64
>>> s2
0 1
1 2
2 3
dtype: int64
```
Contrast with Pandas:
```python
>>> import pandas as pd
>>> s = pd.Series([1, 2, 3])
>>> s2 = s.iloc[:] # s2 is a view into s
>>> s.iloc[0] = -1
>>> s
0 -1
1 2
2 3
dtype: int64
>>> s2
0 -1
1 2
2 3
dtype: int64
```
Note that setting by slice works as expected:
```python
>>> import cudf
>>> s = cudf.Series([1, 2, 3])
>>> s2 = s.iloc[:]
>>> s.iloc[0:1] = -1
>>> s
0 -1
1 2
2 3
dtype: int64
>>> s2
0 -1
1 2
2 3
dtype: int64
```
Contributor guide
Assessment
This issue has not been assessed yet.