hi all,

I tried to write a UDF that handles null values:

def getMinutes(hString, minString):
    if (hString != None) & (minString != None): return int(hString) * 60 +
int(minString[:-1])
    else: return None

flight2 = (flight2.withColumn("duration_minutes",
udfGetMinutes("duration_h", "duration_m")))


but I got this error:

  File "<ipython-input-67-5eb2daa1c1f2>", line 6, in getMinutes
TypeError: int() argument must be a string, a bytes-like object or a
number, not 'NoneType'


Does anyone know how to do this?


Thanks,

Zeming

Reply via email to