1

我正在使用 RAPIDS(0.9 版本)docker 容器。如何使用 RAPIDS cuDF 执行以下操作?

df['new_column'] = df['column_name'] > condition df[['new_column']] *= 1

4

1 回答 1

1

您可以像处理 pandas 一样执行此操作。

import cudf

df = cudf.DataFrame({'a':[0,1,2,3,4]})
df['new'] = df['a'] >= 3
df['new'] = df['new'].astype('int') # could use int8, int32, or int64

# could also do (df['a'] >= 3).astype('int')
df

    a   new
0   0   0
1   1   0
2   2   0
3   3   1
4   4   1
于 2019-08-22T15:48:53.580 回答