or making ignored values undefined (a.k.a NULL):exprs = [ count(when(col("is_fav") == x, True)).alias(c) for (x, c) in [(1, "fv"), (0, "nfv")]]gpd.agg(*exprs) 这篇关于PySpark按条件计数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!