[BUG] Assignment of string columns using `df.loc` fails with type error.
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Describe the bug**
Assignment of string columns using `df.loc` fails with type error.
**Steps/Code to reproduce bug**
```python
import cudf
values = list(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'])
df = cudf.DataFrame({
'existing_column': values[0:10]
})
# succeeds when creating new string column
df.loc[df.index[0:5], 'letters'] = values[0:5]
print(df)
# fails with `ValueError: Unsupported dtype "
> import cudf
>
> values = list(['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'])
>
> df = cudf.DataFrame({
> 'some_existing_column': values[0:10]
> })
>
> df.loc[df.index[0:5], 'letters'] = values[0:5]
> print(df)
>
> df.loc[df.index[5:10], 'letters'] = values[5:10]
> print(df)
> "
some_existing_column letters
0 1 1
1 2 2
2 3 3
3 4 4
4 5 5
5 6
6 7
7 8
8 9
9 0
Traceback (most recent call last):
File "", line 13, in
File "/home/charris/miniconda3/envs/morpheus/lib/python3.8/site-packages/cudf/core/dataframe.py", line 143, in __setitem__
return self._setitem_tuple_arg(key, value)
File "/home/charris/miniconda3/envs/morpheus/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/charris/miniconda3/envs/morpheus/lib/python3.8/site-packages/cudf/core/dataframe.py", line 372, in _setitem_tuple_arg
value = cupy.asarray(value)
File "/home/charris/miniconda3/envs/morpheus/lib/python3.8/site-packages/cupy/_creation/from_data.py", line 66, in asarray
return _core.array(a, dtype, False, order)
File "cupy/_core/core.pyx", line 2164, in cupy._core.core.array
File "cupy/_core/core.pyx", line 2243, in cupy._core.core.array
File "cupy/_core/core.pyx", line 2315, in cupy._core.core._send_object_to_gpu
ValueError: Unsupported dtype
Contributor guide
Assessment
This issue has not been assessed yet.