【发布时间】:2020-04-08 20:27:15
【问题描述】:
我有一个包含以下列的 cuDF 数据框:
columns = ["col1", "col2", "dt"]
datetime64[ns] 形式的 (dt)。
我想编写一个 UDF 以应用于此数据帧中的每个组,并为每个组获取最大的 dt。这是我正在尝试的,但似乎 numba 不支持 UDF 中的 datetime64[ns] 值。
def f1(dt, out):
l = len(dt)
maxvalue = dt[0]
for i in range(cuda.threadIdx.x, l, cuda.blockDim.x):
if dt[i] > maxvalue:
maxvalue = dt[i]
out[:0] = maxvalue
gdf = df.groupby(["col1", "col2"], method="cudf")
df = gdf.apply_grouped(f1, incols={"dt": "dt"}, outcols=dict(out=numpy.datetime64))
这是我得到的错误:
This error is usually caused by passing an argument of a type that is unsupported by the named function.
[1] During: resolving callee type: Function(<numba.cuda.compiler.DeviceFunctionTemplate object at 0x7effda063510>)
[2] During: typing of call at <string> (10)
我有类似的函数,可以很好地处理整数和浮点数。这是否意味着 numba 不支持日期时间?
【问题讨论】: