How do I convert Parquet file with null fields to JSON using PySpark. I need the null fields to be zeroes in the output JSON file. I tried writing
df.withColumn('x', when(
col('x').isNull(),
0.0
).otherwise(col('x'))
Is there any better way to do it?