我在Pyspark中有一个dataframe,我想在其上计算列中的空值和这些列的不同值,即非空值 这是我拥有的数据帧 trans_date transaction_id transaction_id1(*(F.sum(F.col(c).isNull().cast("int")).alias(c) for c in c
例如:How to automatically drop constant columns in pyspark?但我发现,没有一个答案解决了这个问题,即countDistinct()不将空值视为不同的值。因此,只有两个结果null和none NULL值的列也将被删除。一个丑陋的解决方案是将spark dataframe中的所有null值替换为您