I am trying to make a new column based on list of items. cond is a separate independent list outside dataframe "ABC". A new column needs to be created based on few conditions, please see a dummy condition below:-
Rules = ['2'. '5', '18', '33', '47']
ABC = ABC.withColumn("XYZ", when ('2' in cond), col("sqr_4231"))\
.when(('3' in cond), col("sqr_4999"))
but this is giving error - have tried lit('2') and lit('3') but still giving error.