'Apply UDF in cuDF failing
based on my cuDF data I want to create a new column called "Leg" :
| DateTime |Close| SMA |
| -------- | -------------- | -------- |
| 2004-10-25 01:00:00 | 87.17 | 86 |
| 2004-10-25 01:30:00 | 87.18 | 86.02 |
| 2004-10-25 02:00:00 | 87.14 | 85.99 |
| 2004-10-25 02:30:00 | 87 | 85.5 |
| 2004-10-25 03:00:00 | 87.03 | 85.55 |
def is_leg(Close, SMA, Leg):
for i in Close :
if i==0:
i = i+2
elif Close[i-2]>SMA[i-2] and Close[i-1]>SMA[i-1] and Close[i]>SMA[i]:
Leg[i] = 1
elif Close[i-2]<SMA[i-2] and Close[i-1]<SMA[i-1] and Close[i]<SMA[i]:
Leg[i] = -1
else:
Leg[i] = 0
and trying to run it on my cuDF with :
import numpy as np
CJ_m30 = CJ_m30.apply_rows(is_leg,
incols = {'Close':'Close','SMA':'SMA'},
outcols = dict(Leg=np.float64),
kwargs=dict())
Gives me the error :
TypingError: Failed in cuda mode pipeline (step: nopython frontend) Failed in cuda mode pipeline (step: nopython frontend) No implementation of function Function() found for signature:
getitem(array(float64, 1d, A), float64)
Can someone explain me ? I want to create Leg column ... I'm new to Rapids environment.
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
