📅  最后修改于: 2022-03-11 14:58:19.648000             🧑  作者: Mango
cols = df.columns
from pyspark.sql import functions as F
condition = reduce(lambda variable1, variable2: variable1 & variable2, map(lambda c: F.col(c) >= 0, cols))
df.withColumn("column_name", F.when(condition, 1)
.otherwise(0)).show()