Getting rows having nulls for a column
๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐ ๐๐๐๐๐๐๐
isNotNull() : True if the current expression is NOT null.
isNull() : True if the current expression is null.
With this you can get the total count of null or not null values in the column using PySpark
Read article : https://www.freshers.in/article/spark/pyspark-how-to-get-rows-having-nulls-for-a-column-or-columns-without-nulls-or-count-of-non-null/
Get complete source code in the above article
#freshers #freshers2024 #PySpark #BigData #Spark #DataAnalysis
PySpark how to get rows having nulls for a column or columns without nulls or count of Non null - Freshers.in
pyspark.sql.Column.isNotNull isNotNull() : True if the current expression is NOT null. isNull() : True if the current expression is null. With this you can get the total count of null or not null values in the column using PySpark from pyspark.sql import SparkSession spark = SparkSession.builder.appName("isNotNull @ Freshers.in ").getOrCreate() emp_schema= ["name","id","age","gender","dept","state","salary","increment"] emp_data = [ ("Sam",1010,30,"Male","IT",None,125000,8.1), ("Peter",1020,32,"Male","HR","NY",90000,7.0),
