pyspark dataframe fill null with 0 code example
Example: pyspark dataframe fill null with 0
>>> df = spark.createDataFrame([(1,), (2,), (3,), (None,)], ['col'])
>>> df.show()
+----+
| col|
+----+
| 1|
| 2|
| 3|
|null|
+----+
>>> df.na.fill(0).show()
+---+
|col|
+---+
| 1|
| 2|
| 3|
| 0|
+---+