def blank_as_null(x):
    return when(col(x) != '', col(x)).otherwise(None)
dfWithEmptyReplaced = testDF.withColumn('col1', blank_as_null('col1'))
Replace empty strings with None/null values in DataFrame