How to drop column which have null value in dataframe via spark scala

How to drop column which have null value in dataframe via spark scala

Input:



Output:


Solution:

#read csv file

val df = spark.read.format("csv").option("header","True").load("file:///D:/5.12_Cybersecurity_(detail).csv")

df.show()


#drop null value from dataframe

val result_df = df.na.drop()

result_df.show()

Comments