Trying to use simple udf
inside withColumn
, i'm getting the below error.
Actually the order number is a string type and it has the value something like this below and it has no null values.
1234.345.344343434
code:
order_udf = udf(lambda x: x[x.rfind(".") + 1:], StringType())
df.withColumn("order_number", order_udf('order_number')).show()
Do i need to change something on udf call?
344343434
. - notNulludf
instead of regular spark functions? like regexp_replace (or) split? - notNull