Quoting Python's Coding Style Guidelines - PEP-008 https://www.python.org/dev/peps/pep-0008/#programming-recommendations
Comparisons to singletons like Noneshould always be done with is or is not, never the equality operators. Cinyoung 2017. 4. 25. 오전 9:22 Zeming Yu <zemin...@gmail.com> 작성: > 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