Pyspark if DF中的陈述

时间:2018-05-10 15:23:30

标签: if-statement dataframe pyspark variable-assignment

在弄清楚如何编码时需要帮助。我有2个过滤器要在Dataframe中检查并分配值。

filters = "LIST_A in {0} AND LIST_B not in {1}".format(include_list,EXCLUDE_list) 

amount = "AND AMT_PD >= 10"

find_df = old_df.if(old_df.format(filters,amount)):
    old_df = old_df.withColumn("ID", F.lit('FOUND'))
            else:
                old_df = old_df.withColumn("ID", F.lit('NOT_FOUND'))

0 个答案:

没有答案