Skip to content
Advertisement

Is there any method to find number of columns having data in pyspark data frame

I have a pyspark data frame that has 7 columns, I have to add a new column named “sum” and calculate a number of columns that have data (Not null) in the sum column.Example a data frame in which yellow highlighted part is required answer

Advertisement

Answer

This sum can be calculated like this:

Hope this helps!

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement