我想将 cuDF 数据帧转换为 cupy ndarray。我在下面使用这个代码:
import time
import numpy as np
import cupy as cp
import cudf
from numba import cuda
df = cudf.read_csv('titanic.csv')
arr_cupy = cp.fromDlpack(df.to_dlpack())
输出:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-176-0d6ff9785189> in <module>
----> 1 arr_cupy = cp.fromDlpack(df.to_dlpack())
~/.conda/envs/rapids_013/lib/python3.7/site-packages/cudf/core/dataframe.py in to_dlpack(self)
3821 import cudf.io.dlpack as dlpack
3822
-> 3823 return dlpack.to_dlpack(self)
3824
3825 @ioutils.doc_to_csv()
~/.conda/envs/rapids_013/lib/python3.7/site-packages/cudf/io/dlpack.py in to_dlpack(cudf_obj)
72 )
73
---> 74 return libdlpack.to_dlpack(gdf_cols)
cudf/_libxx/dlpack.pyx in cudf._libxx.dlpack.to_dlpack()
ValueError: Cannot create a DLPack tensor with null values. Input is required to have null count as zero.
我收到此错误是因为数据集有空值。我怎样才能做到这一点??