[BUG] `pylibcudf.Column.from_iterable_of_py(<nested_list>, dtype=plc.TypeId.LIST)` erroneously raises
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
**Steps/Code to reproduce bug**
```python
In [1]: import pylibcudf as plc
In [2]: plc.Column.from_iterable_of_py([[1, 2, 3]]) # works
Out[2]:
In [3]: plc.Column.from_iterable_of_py([[1, 2, 3]], dtype=plc.DataType(plc.TypeId.LIST))
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/cudf/python/pylibcudf/pylibcudf/types.pyx:151, in pylibcudf.types.DataType._python_typecode.__get__()
KeyError:
During handling of the above exception, another exception occurred:
NotImplementedError Traceback (most recent call last)
Cell In[3], line 1
----> 1 plc.Column.from_iterable_of_py([[1, 2, 3]], dtype=plc.DataType(plc.TypeId.LIST))
File ~/cudf/python/pylibcudf/pylibcudf/column.pyx:1238, in pylibcudf.column.Column.from_iterable_of_py()
File ~/cudf/python/pylibcudf/pylibcudf/types.pyx:153, in pylibcudf.types.DataType._python_typecode.__get__()
NotImplementedError: No Python typecode for DataType
```
I believe here we should still be "flattening" and inferring the inner type in the `else` clause if a `plc.DataType(plc.TypeId.LIST)` is passed
```python
if dtype is None:
depth, py_dtype = _infer_list_depth_and_dtype(obj)
dtype = DataType.from_py(py_dtype)
else:
depth, _ = _infer_list_depth_and_dtype(obj)
```
**Expected behavior**
Same as `Out[2]`
Contributor guide
Assessment
This issue has not been assessed yet.